Search in sources :

Example 1 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo 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 2 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.

the class TestSmartProxy method init.

@Before
public void init() throws Exception {
    // because of https://issues.jenkins-ci.org/browse/JENKINS-29285, test is unstable on windows
    assumeTrue(OperatingSystem.getOperatingSystem() != OperatingSystem.windows);
    // log all data transfer related events
    ProActiveLogger.getLogger(SchedulerProxyUserInterface.class).setLevel(Level.DEBUG);
    workLocalFolder = new File(workFolderPath);
    inputLocalFolder = new File(workLocalFolder, "input");
    outputLocalFolder = new File(workLocalFolder, "output");
    inputLocalFolder.mkdirs();
    outputLocalFolder.mkdirs();
    // ----------------- start Data Server -------------
    // this simulates a remote data server
    // dataServerURI =
    // dataProvider.deployProActiveDataServer(dataServerFolderPath, "data");
    dataServerURI = (new File(dataServerFolderPath)).toURI().toURL().toExternalForm();
    // start scheduler and nodes
    schedulerHelper.getSchedulerAuth();
    schedProxy = SmartProxyImpl.getActiveInstance();
    schedProxy.cleanDatabase();
    String schedulerUrl = SchedulerTHelper.getLocalUrl();
    schedProxy.setSessionName(TEST_SESSION_NAME);
    schedProxy.init(new ConnectionInfo(schedulerUrl, TestUsers.DEMO.username, TestUsers.DEMO.password, null, true));
    eventListener = new MyEventListener();
    MyEventListener myListenerRemoteReference = PAActiveObject.turnActive(eventListener);
    schedProxy.addEventListener(myListenerRemoteReference);
}
Also used : SchedulerProxyUserInterface(org.ow2.proactive.scheduler.common.util.SchedulerProxyUserInterface) ConnectionInfo(org.ow2.proactive.authentication.ConnectionInfo) File(java.io.File) Before(org.junit.Before)

Example 3 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.

the class RestSmartProxyTest method initializeRestSmartProxyInstance.

private void initializeRestSmartProxyInstance() throws Exception {
    restSmartProxy = new RestSmartProxyImpl();
    restSmartProxy.cleanDatabase();
    restSmartProxy.setSessionName(uniqueSessionId());
    restSmartProxy.init(new ConnectionInfo(getRestServerUrl(), getLogin(), getPassword(), null, true));
    userspace = restSmartProxy.getUserSpaceURIs().get(0);
    pushUrl = userspace;
    pullUrl = userspace;
    // we add special characters and space to the folders to make sure
    // transfer occurs normally
    inputLocalFolder = tempDir.newFolder("input é");
    outputLocalFolder = tempDir.newFolder("output é");
}
Also used : RestSmartProxyImpl(org.ow2.proactive_grid_cloud_portal.smartproxy.RestSmartProxyImpl) ConnectionInfo(org.ow2.proactive.authentication.ConnectionInfo)

Example 4 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.

the class SchedulerNodeClient method connect.

/**
 * Connects to the scheduler at the specified schedulerRestUrl, using the current user credentials
 * @param url schedulerRestUrl of the scheduler
 * @throws Exception
 */
public void connect(String url) throws Exception {
    CredData userCreds = decrypter.decrypt();
    client = SchedulerClient.createInstance();
    client.init(new ConnectionInfo(url, userCreds.getLogin(), userCreds.getPassword(), null, true));
}
Also used : CredData(org.ow2.proactive.authentication.crypto.CredData) ConnectionInfo(org.ow2.proactive.authentication.ConnectionInfo)

Example 5 with ConnectionInfo

use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.

the class RestSmartProxyImpl method init.

@Override
public void init(ConnectionInfo connectionInfo) {
    try {
        this.connectionInfo = connectionInfo;
        this.restSchedulerClient = SchedulerClient.createInstance();
        this.restSchedulerClient.init(new ConnectionInfo(connectionInfo.getUrl(), connectionInfo.getLogin(), connectionInfo.getPassword(), connectionInfo.getCredentialFile(), connectionInfo.isInsecure()));
        DataSpaceClient restDsClient = new DataSpaceClient();
        restDsClient.init(connectionInfo.getUrl(), this.restSchedulerClient);
        this.restDataSpaceClient = restDsClient;
        super.jobTracker.setRestDataSpaceClient(this.restDataSpaceClient);
        this.jobTracker.loadJobs();
        setInitialized(true);
        registerAsListener();
        syncAwaitedJobs();
    } catch (Exception e) {
        Throwables.propagate(e);
    }
}
Also used : IDataSpaceClient(org.ow2.proactive.scheduler.rest.ds.IDataSpaceClient) DataSpaceClient(org.ow2.proactive.scheduler.rest.ds.DataSpaceClient) ConnectionInfo(org.ow2.proactive.authentication.ConnectionInfo) TimeoutException(java.util.concurrent.TimeoutException) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException)

Aggregations

ConnectionInfo (org.ow2.proactive.authentication.ConnectionInfo)9 ISchedulerClient (org.ow2.proactive.scheduler.rest.ISchedulerClient)4 File (java.io.File)2 KeyException (java.security.KeyException)2 Test (org.junit.Test)2 CredData (org.ow2.proactive.authentication.crypto.CredData)2 PublicKey (java.security.PublicKey)1 TimeoutException (java.util.concurrent.TimeoutException)1 LoginException (javax.security.auth.login.LoginException)1 HttpClient (org.apache.http.client.HttpClient)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 ApacheHttpClient4Engine (org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine)1 ResteasyProviderFactory (org.jboss.resteasy.spi.ResteasyProviderFactory)1 Before (org.junit.Before)1 UserData (org.ow2.proactive.authentication.UserData)1 Credentials (org.ow2.proactive.authentication.crypto.Credentials)1 HttpClientBuilder (org.ow2.proactive.http.HttpClientBuilder)1 SchedulerAuthenticationInterface (org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)1 InternalSchedulerException (org.ow2.proactive.scheduler.common.exception.InternalSchedulerException)1 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)1