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 * 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 4.0.27 06/07/2020
------ ------
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId> <groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem</artifactId> <artifactId>nomadcommandsystem</artifactId>
<version>4.0.30-beta</version> <version>4.0.28</version>
<name>NomadCommandSystem</name> <name>NomadCommandSystem</name>
<description>Java bridge for the communication with the Nomad server</description> <description>Java bridge for the communication with the Nomad server</description>
<scm> <scm>
......
...@@ -38,15 +38,19 @@ public class LoginManager { ...@@ -38,15 +38,19 @@ public class LoginManager {
} }
public class LoginIncorrectException extends Exception {} public class LoginIncorrectException extends Exception {}
public class MultipleClientsPerEndpointNotAllowedException extends Exception {}
public class MultipleConnectionsPerUserNotAllowedException extends Exception {}
public class ClientAlreadyLaunchedException extends Exception {} public class ClientAlreadyLaunchedException extends Exception {}
public class ConnectionFailure 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 { try {
ServerSessionManager.getInstance(serverId).login(standalone, login); ServerSessionManager.getInstance(serverId).login(standalone, login);
} catch (SessionManager.ClientAlreadyLaunchedException e) { } catch (SessionManager.MultipleConnectionsPerUserNotAllowedException e) {
throw new ClientAlreadyLaunchedException(); throw new MultipleConnectionsPerUserNotAllowedException();
} catch (SessionManager.MultipleClientsPerEndpointNotAllowedException e) {
throw new MultipleClientsPerEndpointNotAllowedException();
} catch (ServerSessionManager.ConnectionFailure e) { } catch (ServerSessionManager.ConnectionFailure e) {
throw new ConnectionFailure(); throw new ConnectionFailure();
} catch (LoadFailure e) { } catch (LoadFailure e) {
...@@ -58,7 +62,7 @@ public class LoginManager { ...@@ -58,7 +62,7 @@ public class LoginManager {
public void logintab(String login, String password, boolean standalone, String serverId) throws LoginIncorrectException, ClientAlreadyLaunchedException, ConnectionFailure { public void logintab(String login, String password, boolean standalone, String serverId) throws LoginIncorrectException, ClientAlreadyLaunchedException, ConnectionFailure {
try { try {
ServerSessionManager.getInstance(serverId).logintab(standalone); ServerSessionManager.getInstance(serverId).logintab(standalone);
} catch (SessionManager.ClientAlreadyLaunchedException e) { } catch (SessionManager.MultipleConnectionsPerUserNotAllowedException | SessionManager.MultipleClientsPerEndpointNotAllowedException e) {
throw new ClientAlreadyLaunchedException(); throw new ClientAlreadyLaunchedException();
} catch (ServerSessionManager.ConnectionFailure e) { } catch (ServerSessionManager.ConnectionFailure e) {
throw new ConnectionFailure(); throw new ConnectionFailure();
......
...@@ -36,7 +36,8 @@ import fr.ill.ics.nscclient.notification.commandzone.ServerCommandZoneEventManag ...@@ -36,7 +36,8 @@ import fr.ill.ics.nscclient.notification.commandzone.ServerCommandZoneEventManag
import fr.ill.ics.nscclient.ploty.PlotyInstance; import fr.ill.ics.nscclient.ploty.PlotyInstance;
import fr.ill.ics.nscclient.servant.ConfigurationManager; import fr.ill.ics.nscclient.servant.ConfigurationManager;
import fr.ill.ics.nscclient.servant.ConfigurationManager.LoadFailure; 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.survey.SurveySubscriberImpl;
import fr.ill.ics.nscclient.variable.VariableManagerAccessor; import fr.ill.ics.nscclient.variable.VariableManagerAccessor;
import fr.ill.ics.util.ConfigManager; import fr.ill.ics.util.ConfigManager;
...@@ -84,14 +85,13 @@ public class ServerSessionManager { ...@@ -84,14 +85,13 @@ public class ServerSessionManager {
return instances.get(serverId); 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(); init();
try { try {
SessionManager.getInstance(serverId).login(standAlone, ConfigManager.getInstance().getClientType(), user); SessionManager.getInstance(serverId).login(standAlone, ConfigManager.getInstance().getClientType(), user);
} } catch (MultipleConnectionsPerUserNotAllowedException | MultipleClientsPerEndpointNotAllowedException e) {
catch (ClientAlreadyLaunchedException e) {
// Only rethrow the exception. The call to logoutAll is made in the main application. // Only rethrow the exception. The call to logoutAll is made in the main application.
throw e; throw e;
} }
...@@ -109,7 +109,7 @@ public class ServerSessionManager { ...@@ -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(); SessionManager.getInstance(serverId).init();
...@@ -126,8 +126,7 @@ public class ServerSessionManager { ...@@ -126,8 +126,7 @@ public class ServerSessionManager {
try { try {
SessionManager.getInstance(serverId).login(standAlone, "tablet"); SessionManager.getInstance(serverId).login(standAlone, "tablet");
} } catch (MultipleConnectionsPerUserNotAllowedException | MultipleClientsPerEndpointNotAllowedException e) {
catch (ClientAlreadyLaunchedException e) {
logoutAll(false); logoutAll(false);
throw e; throw e;
} }
......
...@@ -104,11 +104,11 @@ public class SessionManager { ...@@ -104,11 +104,11 @@ public class SessionManager {
sessionRequester.terminate(); 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); 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. // Create the message type.
SessionRequests.Message type = SessionRequests.Message.newBuilder() SessionRequests.Message type = SessionRequests.Message.newBuilder()
...@@ -139,10 +139,10 @@ public class SessionManager { ...@@ -139,10 +139,10 @@ public class SessionManager {
// Process the error. // Process the error.
if (response.getError() == Common.Error.Type.MULTIPLE_CONNECTIONS_PER_USER_NOT_ALLOWED) { 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) { else if (response.getError() == Common.Error.Type.MULTIPLE_CLIENTS_PER_ENDPOINT_NOT_ALLOWED) {
throw new ClientAlreadyLaunchedException(); throw new MultipleClientsPerEndpointNotAllowedException();
} }
// Get the client id. // 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