Commit ecdede54 authored by helene ortiz's avatar helene ortiz
Browse files

version 4.0.28

parent 37ebb839
4.0.28 17/07/2020
------
* Add token stuff in ploty2
* Manage specific error messages for remote computers: multiple connections per user or multiple clients per endpoint.
* Implemented the check of client (TOKEN_NOT_OWNED error)
* Client type is passed at login
4.0.27 06/07/2020
------
......
......@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem</artifactId>
<version>4.0.30-beta</version>
<version>4.0.28</version>
<name>NomadCommandSystem</name>
<description>Java bridge for the communication with the Nomad server</description>
<scm>
......
......@@ -38,15 +38,19 @@ public class LoginManager {
}
public class LoginIncorrectException extends Exception {}
public class MultipleClientsPerEndpointNotAllowedException extends Exception {}
public class MultipleConnectionsPerUserNotAllowedException extends Exception {}
public class ClientAlreadyLaunchedException extends Exception {}
public class ConnectionFailure extends Exception {};
public void login(String login, boolean standalone, String serverId) throws LoginIncorrectException, ClientAlreadyLaunchedException, ConnectionFailure {
public void login(String login, boolean standalone, String serverId) throws LoginIncorrectException, MultipleClientsPerEndpointNotAllowedException, MultipleConnectionsPerUserNotAllowedException, ConnectionFailure {
try {
ServerSessionManager.getInstance(serverId).login(standalone, login);
} catch (SessionManager.ClientAlreadyLaunchedException e) {
throw new ClientAlreadyLaunchedException();
} catch (SessionManager.MultipleConnectionsPerUserNotAllowedException e) {
throw new MultipleConnectionsPerUserNotAllowedException();
} catch (SessionManager.MultipleClientsPerEndpointNotAllowedException e) {
throw new MultipleClientsPerEndpointNotAllowedException();
} catch (ServerSessionManager.ConnectionFailure e) {
throw new ConnectionFailure();
} catch (LoadFailure e) {
......@@ -58,7 +62,7 @@ public class LoginManager {
public void logintab(String login, String password, boolean standalone, String serverId) throws LoginIncorrectException, ClientAlreadyLaunchedException, ConnectionFailure {
try {
ServerSessionManager.getInstance(serverId).logintab(standalone);
} catch (SessionManager.ClientAlreadyLaunchedException e) {
} catch (SessionManager.MultipleConnectionsPerUserNotAllowedException | SessionManager.MultipleClientsPerEndpointNotAllowedException e) {
throw new ClientAlreadyLaunchedException();
} catch (ServerSessionManager.ConnectionFailure e) {
throw new ConnectionFailure();
......
......@@ -36,7 +36,8 @@ import fr.ill.ics.nscclient.notification.commandzone.ServerCommandZoneEventManag
import fr.ill.ics.nscclient.ploty.PlotyInstance;
import fr.ill.ics.nscclient.servant.ConfigurationManager;
import fr.ill.ics.nscclient.servant.ConfigurationManager.LoadFailure;
import fr.ill.ics.nscclient.sessionmanagement.SessionManager.ClientAlreadyLaunchedException;
import fr.ill.ics.nscclient.sessionmanagement.SessionManager.MultipleClientsPerEndpointNotAllowedException;
import fr.ill.ics.nscclient.sessionmanagement.SessionManager.MultipleConnectionsPerUserNotAllowedException;
import fr.ill.ics.nscclient.survey.SurveySubscriberImpl;
import fr.ill.ics.nscclient.variable.VariableManagerAccessor;
import fr.ill.ics.util.ConfigManager;
......@@ -84,14 +85,13 @@ public class ServerSessionManager {
return instances.get(serverId);
}
public void login(boolean standAlone, String user) throws SessionManager.ClientAlreadyLaunchedException, ConnectionFailure, LoadFailure {
public void login(boolean standAlone, String user) throws MultipleConnectionsPerUserNotAllowedException, MultipleClientsPerEndpointNotAllowedException, ConnectionFailure, LoadFailure {
init();
try {
SessionManager.getInstance(serverId).login(standAlone, ConfigManager.getInstance().getClientType(), user);
}
catch (ClientAlreadyLaunchedException e) {
} catch (MultipleConnectionsPerUserNotAllowedException | MultipleClientsPerEndpointNotAllowedException e) {
// Only rethrow the exception. The call to logoutAll is made in the main application.
throw e;
}
......@@ -109,7 +109,7 @@ public class ServerSessionManager {
}
}
public void logintab(boolean standAlone) throws SessionManager.ClientAlreadyLaunchedException, ConnectionFailure, LoadFailure {
public void logintab(boolean standAlone) throws MultipleClientsPerEndpointNotAllowedException, MultipleConnectionsPerUserNotAllowedException, ConnectionFailure, LoadFailure {
SessionManager.getInstance(serverId).init();
......@@ -126,8 +126,7 @@ public class ServerSessionManager {
try {
SessionManager.getInstance(serverId).login(standAlone, "tablet");
}
catch (ClientAlreadyLaunchedException e) {
} catch (MultipleConnectionsPerUserNotAllowedException | MultipleClientsPerEndpointNotAllowedException e) {
logoutAll(false);
throw e;
}
......
......@@ -104,11 +104,11 @@ public class SessionManager {
sessionRequester.terminate();
}
public void login(boolean standAlone, String clientType) throws ClientAlreadyLaunchedException {
public void login(boolean standAlone, String clientType) throws MultipleConnectionsPerUserNotAllowedException, MultipleClientsPerEndpointNotAllowedException {
login(standAlone, clientType, null);
}
public synchronized void login(boolean standAlone, String clientType, String user) throws ClientAlreadyLaunchedException {
public synchronized void login(boolean standAlone, String clientType, String user) throws MultipleConnectionsPerUserNotAllowedException, MultipleClientsPerEndpointNotAllowedException {
// Create the message type.
SessionRequests.Message type = SessionRequests.Message.newBuilder()
......@@ -139,10 +139,10 @@ public class SessionManager {
// Process the error.
if (response.getError() == Common.Error.Type.MULTIPLE_CONNECTIONS_PER_USER_NOT_ALLOWED) {
throw new ClientAlreadyLaunchedException();
throw new MultipleConnectionsPerUserNotAllowedException();
}
else if (response.getError() == Common.Error.Type.MULTIPLE_CLIENTS_PER_ENDPOINT_NOT_ALLOWED) {
throw new ClientAlreadyLaunchedException();
throw new MultipleClientsPerEndpointNotAllowedException();
}
// Get the client id.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment