Search in sources :

Example 1 with InternalSchedulerException

use of org.ow2.proactive.scheduler.common.exception.InternalSchedulerException in project scheduling by ow2-proactive.

the class SchedulerProxyUserInterface method init.

/**
 * initialize the connection the scheduler.
 * Must be called only once.
 * Create the corresponding credential object before sending it
 * to the scheduler.
 * @param url the scheduler's url
 * @param credData the credential object that contains user-related data
 * @throws SchedulerException thrown if the scheduler is not available
 * @throws LoginException if the couple username/password is invalid
 * @since Scheduling 3.1.0
 */
public void init(String url, CredData credData) throws SchedulerException, LoginException {
    SchedulerAuthenticationInterface auth = SchedulerConnection.join(url);
    PublicKey pubKey = auth.getPublicKey();
    try {
        Credentials cred = Credentials.createCredentials(credData, pubKey);
        this.uischeduler = auth.login(cred);
        mbeaninfoviewer = new MBeanInfoViewer(auth, credData.getLogin(), cred);
    } catch (KeyException e) {
        throw new InternalSchedulerException(e);
    }
}
Also used : InternalSchedulerException(org.ow2.proactive.scheduler.common.exception.InternalSchedulerException) MBeanInfoViewer(org.ow2.proactive.utils.console.MBeanInfoViewer) PublicKey(java.security.PublicKey) SchedulerAuthenticationInterface(org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface) Credentials(org.ow2.proactive.authentication.crypto.Credentials) KeyException(java.security.KeyException)

Example 2 with InternalSchedulerException

use of org.ow2.proactive.scheduler.common.exception.InternalSchedulerException in project scheduling by ow2-proactive.

the class SchedulerStarter method startScheduler.

private static SchedulerAuthenticationInterface startScheduler(CommandLine commandLine, String rmUrl) throws URISyntaxException, InternalSchedulerException, ParseException, SocketException, UnknownHostException, IllegalArgumentException {
    String policyFullName = getPolicyFullName(commandLine);
    LOGGER.info("Scheduler version is " + getSchedulerVersion());
    LOGGER.info("Starting the scheduler...");
    SchedulerAuthenticationInterface sai = null;
    try {
        sai = SchedulerFactory.startLocal(new URI(rmUrl), policyFullName);
        startDiscovery(commandLine, rmUrl);
        LOGGER.info("The scheduler created on " + sai.getHostURL());
    } catch (Exception e) {
        e.printStackTrace();
    }
    return sai;
}
Also used : SchedulerAuthenticationInterface(org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface) URI(java.net.URI) LoginException(javax.security.auth.login.LoginException) KeyException(java.security.KeyException) URISyntaxException(java.net.URISyntaxException) InternalSchedulerException(org.ow2.proactive.scheduler.common.exception.InternalSchedulerException) ParseException(org.apache.commons.cli.ParseException) InvalidScriptException(org.ow2.proactive.scripting.InvalidScriptException) SocketException(java.net.SocketException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) ProActiveException(org.objectweb.proactive.core.ProActiveException) AlreadyBoundException(java.rmi.AlreadyBoundException)

Example 3 with InternalSchedulerException

use of org.ow2.proactive.scheduler.common.exception.InternalSchedulerException in project scheduling by ow2-proactive.

the class SmartProxyImpl method init.

private void init(String url, Credentials credentials, CredData credData) throws SchedulerException, LoginException {
    if (this.connectionInfo == null) {
        this.connectionInfo = new ConnectionInfo(url, null, null, null, false);
    }
    this.connectionInfo.setUrl(url);
    this.credentials = credentials;
    this.credData = credData;
    SchedulerAuthenticationInterface auth = SchedulerConnection.join(url);
    PublicKey pubKey = auth.getPublicKey();
    if (this.credentials != null) {
        this.credentials = credentials;
        this.credData = null;
    } else if (this.credData != null) {
        this.credData = credData;
        try {
            this.credentials = Credentials.createCredentials(credData, pubKey);
        } catch (KeyException e) {
            throw new InternalSchedulerException(e);
        }
    } else {
        throw new IllegalStateException("No valid credential available to connect to the scheduler");
    }
    this.schedulerProxy = auth.login(this.credentials);
    jobTracker.loadJobs();
    setInitialized(true);
    registerAsListener();
    syncAwaitedJobs();
}
Also used : InternalSchedulerException(org.ow2.proactive.scheduler.common.exception.InternalSchedulerException) PublicKey(java.security.PublicKey) SchedulerAuthenticationInterface(org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface) ConnectionInfo(org.ow2.proactive.authentication.ConnectionInfo) KeyException(java.security.KeyException)

Example 4 with InternalSchedulerException

use of org.ow2.proactive.scheduler.common.exception.InternalSchedulerException in project scheduling by ow2-proactive.

the class SchedulerFactory method startLocal.

/**
 * Creates and starts a Scheduler on the local host using the given initializer to configure it.
 * Only one Scheduler can be started by JVM.
 *
 * @param rmURL the URL of a started Resource Manager
 * @param initializer Use to configure the Scheduler before starting it.
 * 		This parameter cannot be null.
 *
 * @return a Scheduler authentication that allow you to administer it or get its connection URL.
 *
 * @throws InternalSchedulerException If Scheduler cannot be created
 */
public static synchronized SchedulerAuthenticationInterface startLocal(URI rmURL, SchedulerInitializer initializer) throws InternalSchedulerException {
    if (!schedulerStarted) {
        if (!allowNullInit) {
            if (initializer != null) {
                // configure application
                configure(initializer);
            } else {
                throw new IllegalArgumentException("Initializer cannot be null!");
            }
        }
        if (rmURL == null) {
            throw new IllegalArgumentException("RM url is null!");
        }
        try {
            String policy = initializer.getPolicyFullClassName();
            // start scheduler
            createScheduler(rmURL, policy);
            SchedulerAuthenticationInterface sai = SchedulerConnection.waitAndJoin(null);
            schedulerStarted = true;
            return sai;
        } catch (Exception e) {
            throw new InternalSchedulerException(e);
        }
    } else {
        throw new InternalSchedulerException("Scheduler already localy running");
    }
}
Also used : InternalSchedulerException(org.ow2.proactive.scheduler.common.exception.InternalSchedulerException) SchedulerAuthenticationInterface(org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface) LoginException(javax.security.auth.login.LoginException) ActiveObjectCreationException(org.objectweb.proactive.ActiveObjectCreationException) AdminSchedulerException(org.ow2.proactive.scheduler.exception.AdminSchedulerException) InternalSchedulerException(org.ow2.proactive.scheduler.common.exception.InternalSchedulerException) SchedulerException(org.ow2.proactive.scheduler.common.exception.SchedulerException) RMException(org.ow2.proactive.resourcemanager.exception.RMException)

Aggregations

SchedulerAuthenticationInterface (org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)4 InternalSchedulerException (org.ow2.proactive.scheduler.common.exception.InternalSchedulerException)4 KeyException (java.security.KeyException)3 PublicKey (java.security.PublicKey)2 LoginException (javax.security.auth.login.LoginException)2 IOException (java.io.IOException)1 SocketException (java.net.SocketException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 UnknownHostException (java.net.UnknownHostException)1 AlreadyBoundException (java.rmi.AlreadyBoundException)1 ParseException (org.apache.commons.cli.ParseException)1 ActiveObjectCreationException (org.objectweb.proactive.ActiveObjectCreationException)1 ProActiveException (org.objectweb.proactive.core.ProActiveException)1 ConnectionInfo (org.ow2.proactive.authentication.ConnectionInfo)1 Credentials (org.ow2.proactive.authentication.crypto.Credentials)1 RMException (org.ow2.proactive.resourcemanager.exception.RMException)1 SchedulerException (org.ow2.proactive.scheduler.common.exception.SchedulerException)1 AdminSchedulerException (org.ow2.proactive.scheduler.exception.AdminSchedulerException)1 InvalidScriptException (org.ow2.proactive.scripting.InvalidScriptException)1