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();
}
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);
}
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 é");
}
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));
}
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);
}
}
Aggregations