Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadCommandSystem
Commits
22b98729
Commit
22b98729
authored
Jun 09, 2020
by
Locatelli
Browse files
Add get ploty version from server
parent
331ef8e4
Changes
7
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
22b98729
4.0.16 09/06/2020
------
* Get ploty version from nomad server.
4.0.15 05/06/2020
------
* Corrected blocking when exiting.
...
...
pom.xml
View file @
22b98729
...
...
@@ -2,7 +2,7 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
fr.ill.ics
</groupId>
<artifactId>
nomadcommandsystem
</artifactId>
<version>
4.0.1
5
</version>
<version>
4.0.1
6
</version>
<name>
NomadCommandSystem
</name>
<description>
Java bridge for the communication with the Nomad server
</description>
<scm>
...
...
src/main/java/fr/ill/ics/bridge/ChangeManager.java
View file @
22b98729
...
...
@@ -22,11 +22,13 @@ import java.util.Iterator;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
fr.ill.ics.bridge.command.CommandZoneWrapper
;
import
fr.ill.ics.nscclient.log.LogSubscriber
;
import
fr.ill.ics.nscclient.notification.DataNotificationClient
;
import
fr.ill.ics.nscclient.notification.commandzone.CommandZoneEventClient
;
import
fr.ill.ics.nscclient.notification.commandzone.sync.CommandZoneSyncEventClient
;
import
fr.ill.ics.nscclient.ploty.PlotyInstance
;
import
fr.ill.ics.nscclient.sessionmanagement.SessionManager
;
import
fr.ill.ics.nscclient.survey.SurveySubscriberImpl
;
import
fr.ill.ics.util.ConfigManager
;
...
...
@@ -52,7 +54,7 @@ public class ChangeManager {
DataNotificationClient
.
getInstance
().
readAndDispatch
();
CommandZoneEventClient
.
getInstance
().
readAndDispatch
();
CommandZoneSyncEventClient
.
getInstance
().
readAndDispatch
();
if
(
Config
Manager
.
getInstance
().
getPlotyVersion
()
==
2
)
{
if
(
Session
Manager
.
getInstance
(
CommandZoneWrapper
.
SERVER_ID
).
getPlotyVersion
()
==
2
)
{
PlotyInstance
.
getInstance
().
readAndDispatch
();
}
...
...
src/main/java/fr/ill/ics/nscclient/ploty/PlotyInstance.java
View file @
22b98729
...
...
@@ -81,7 +81,9 @@ public class PlotyInstance {
Application
.
Instance
ploty
=
null
;
if
(
ConfigManager
.
getInstance
().
getString
(
ConfigManager
.
CLIENT_TYPE_PROPERTY
).
contains
(
"main"
))
{
String
nomadServerEndpoint
=
ConfigManager
.
getInstance
().
getNomadServerEndpoint
();
if
(
serverEndpoint
.
contentEquals
(
nomadServerEndpoint
))
{
// Client on a same machine as server
try
{
ploty
=
server
.
connect
(
PLOTY_NAME
);
}
catch
(
ConnectionTimeout
e
)
{
...
...
@@ -90,6 +92,7 @@ public class PlotyInstance {
}
}
else
{
// Client on a different machine as server
List
<
Info
>
info
=
server
.
getApplicationInfos
(
PLOTY_NAME
);
if
(
info
.
isEmpty
()
==
false
)
{
server
.
killAllAndWaitFor
(
PLOTY_NAME
);
...
...
src/main/java/fr/ill/ics/nscclient/sessionmanagement/ServerSessionManager.java
View file @
22b98729
...
...
@@ -155,7 +155,7 @@ public class ServerSessionManager {
SurveySubscriberImpl
.
getInstance
(
serverId
).
unsubscribe
();
DataChangeSubscriber
.
getInstance
(
serverId
).
unsubscribe
();
if
(
serverId
.
equals
(
"real"
))
{
if
(
Config
Manager
.
getInstance
().
getPlotyVersion
()
==
2
)
{
if
(
Session
Manager
.
getInstance
(
serverId
).
getPlotyVersion
()
==
2
)
{
PlotyInstance
.
getInstance
().
unsubscribe
();
}
}
...
...
@@ -195,7 +195,7 @@ public class ServerSessionManager {
}
if
(
serverId
.
equals
(
"real"
))
{
if
(
Config
Manager
.
getInstance
().
getPlotyVersion
()
==
2
)
{
if
(
Session
Manager
.
getInstance
(
serverId
).
getPlotyVersion
()
==
2
)
{
try
{
PlotyInstance
.
getInstance
().
unsubscribe
();
}
catch
(
Exception
e
)
{
...
...
src/main/java/fr/ill/ics/nscclient/sessionmanagement/SessionManager.java
View file @
22b98729
...
...
@@ -42,7 +42,7 @@ public class SessionManager {
private
String
remoteUserName
;
private
String
password
;
private
String
instrumentName
;
private
int
plotyVersion
=
0
;
private
String
user
=
null
;
...
...
@@ -310,6 +310,26 @@ public class SessionManager {
}
}
public
synchronized
int
getServerPlotyVersion
()
{
// Create the message type.
SessionRequests
.
Message
type
=
SessionRequests
.
Message
.
newBuilder
()
.
setType
(
SessionRequests
.
Message
.
Type
.
PlotyVersion
)
.
build
();
sessionRequester
.
send
(
type
.
toByteArray
());
int
version
=
0
;
try
{
version
=
Common
.
Int32Response
.
parseFrom
(
sessionRequester
.
receive
()).
getValue
();
}
catch
(
InvalidProtocolBufferException
e
)
{
System
.
err
.
println
(
"error in parsing response of getPlotyVersion"
);
}
return
version
;
}
public
boolean
isOk
()
{
return
allOk
;
}
...
...
@@ -334,6 +354,12 @@ public class SessionManager {
return
remoteUserName
;
}
public
int
getPlotyVersion
()
{
if
(
plotyVersion
==
0
)
{
plotyVersion
=
getServerPlotyVersion
();
}
return
plotyVersion
;
}
private
String
getUser
()
{
if
(
user
==
null
)
{
...
...
src/main/java/fr/ill/ics/util/ConfigManager.java
View file @
22b98729
...
...
@@ -620,13 +620,13 @@ public class ConfigManager {
return
false
;
}
public
int
getPlotyVersion
()
{
String
value
=
getStringOrNothingAtAll
(
"plotyVersion"
);
if
(
value
!=
null
)
{
return
Integer
.
valueOf
(
value
.
trim
());
}
return
1
;
}
//
public int getPlotyVersion() {
//
String value = getStringOrNothingAtAll("plotyVersion");
//
if (value != null) {
//
return Integer.valueOf(value.trim());
//
}
//
return 1;
//
}
public
boolean
isRemoteClient
()
{
return
remoteClient
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment