Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadGUI
Commits
8fb8e81a
Commit
8fb8e81a
authored
Apr 28, 2022
by
Sci Test
Browse files
Adapted to Cameo v2
parent
205f4e1b
Changes
8
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
8fb8e81a
...
...
@@ -3,7 +3,7 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
fr.ill.ics
</groupId>
<artifactId>
nomadgui
</artifactId>
<version>
4.
0.135
</version>
<version>
4.
1.0-SNAPSHOT
</version>
<name>
NomadGUI
</name>
<description>
Graphical user interface for Nomad
</description>
<scm>
...
...
@@ -142,7 +142,7 @@
<dependency>
<groupId>
fr.ill.ics
</groupId>
<artifactId>
nomadcommandsystem
</artifactId>
<version>
4.
0.53
</version>
<version>
4.
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<!-- For CollectionUtils -->
<groupId>
org.apache.commons
</groupId>
...
...
src/main/java/fr/ill/ics/apps/LogsTransfer.java
View file @
8fb8e81a
...
...
@@ -4,8 +4,7 @@ import java.io.IOException;
import
java.nio.file.FileSystems
;
import
java.nio.file.Files
;
import
fr.ill.ics.cameo.Application
;
import
fr.ill.ics.cameo.Application.This
;
import
fr.ill.ics.cameo.base.This
;
public
class
LogsTransfer
{
...
...
@@ -44,7 +43,7 @@ public class LogsTransfer {
}
finally
{
// Do not forget to terminate This.
Application
.
This
.
terminate
();
This
.
terminate
();
}
}
}
src/main/java/fr/ill/ics/apps/LogsTransferCaller.java
View file @
8fb8e81a
...
...
@@ -4,8 +4,8 @@ import java.io.File;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
fr.ill.ics.cameo.
Application.Instance
;
import
fr.ill.ics.cameo.Server
;
import
fr.ill.ics.cameo.
base.App
;
import
fr.ill.ics.cameo.
base.
Server
;
public
class
LogsTransferCaller
{
...
...
@@ -17,20 +17,17 @@ public class LogsTransferCaller {
}
try
{
// Get the Cameo server.
Server
server
=
null
;
// The server endpoint is the first argument.
server
=
new
Server
(
args
[
0
]);
// Get the Cameo server. The server endpoint is the first argument.
Server
server
=
Server
.
create
(
args
[
0
]);
// Start the app.
Instance
app
=
server
.
start
(
"logstransfer"
);
App
app
=
server
.
start
(
"logstransfer"
);
app
.
waitFor
();
System
.
out
.
println
(
"Application finished"
);
System
.
out
.
println
(
"Application has result: "
+
app
.
hasResult
());
byte
[]
fileContent
=
app
.
get
Binary
Result
();
byte
[]
fileContent
=
app
.
getResult
();
System
.
out
.
println
(
"Got file content "
+
fileContent
.
length
);
...
...
src/main/java/fr/ill/ics/client/control/MainWindow.java
View file @
8fb8e81a
...
...
@@ -39,9 +39,10 @@ import fr.ill.ics.bridge.events.ServerEndedEvent;
import
fr.ill.ics.bridge.listeners.ClientDisconnectedListener
;
import
fr.ill.ics.bridge.listeners.ServerConfigurationChangeListener
;
import
fr.ill.ics.bridge.listeners.ServerEndedListener
;
import
fr.ill.ics.cameo.Application
;
import
fr.ill.ics.cameo.Application.Instance
;
import
fr.ill.ics.cameo.Server
;
import
fr.ill.ics.cameo.base.App
;
import
fr.ill.ics.cameo.base.Server
;
import
fr.ill.ics.cameo.base.StartException
;
import
fr.ill.ics.cameo.base.This
;
import
fr.ill.ics.client.control.admin.AdministratorLogin
;
import
fr.ill.ics.client.control.command.CommandWindow
;
import
fr.ill.ics.client.control.command.ServerCommandZone
;
...
...
@@ -120,8 +121,8 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
private
Server
cameoServer
;
private
Instance
nomadLogsInstance
;
private
Instance
nomadSurveyInstance
;
private
App
nomadLogsInstance
;
private
App
nomadSurveyInstance
;
private
static
final
String
VIRTUAL_HOME
=
"virtualHome"
;
private
static
final
String
VISA
=
"visa"
;
...
...
@@ -223,7 +224,7 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
System
.
out
.
println
(
"Terminating Cameo application"
);
Application
.
This
.
terminate
();
This
.
terminate
();
System
.
out
.
println
(
"Terminated Cameo application"
);
}
...
...
@@ -693,7 +694,8 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
if
(
cameoServer
==
null
)
{
String
serverLocation
=
ConfigManager
.
getInstance
().
getServerEndpoint
();
if
(
serverLocation
!=
null
)
{
cameoServer
=
new
Server
(
serverLocation
);
cameoServer
=
Server
.
create
(
serverLocation
);
cameoServer
.
init
();
}
}
if
(
cameoServer
!=
null
)
{
...
...
@@ -722,16 +724,16 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
for
(
String
arg:
args
)
{
System
.
out
.
println
(
"arg "
+
arg
);
}
nomadLogsInstance
=
cameoServer
.
start
(
NOMADLOGS_APP_NAME
,
args
);
if
(
nomadLogsInstance
.
exists
())
{
try
{
nomadLogsInstance
=
cameoServer
.
start
(
NOMADLOGS_APP_NAME
,
args
);
System
.
out
.
println
(
"Starting "
+
nomadLogsInstance
);
/* waiting for a real "is running" status (see YLG)
nomadLogsInstance.waitFor(Application.State.RUNNING);
System.out.println(nomadLogsInstance + " started");
*/
}
else
if
(
nomadLogsInstance
.
getErrorMessage
()
!=
null
)
{
DialogManager
.
getInstance
().
nomadMessageDialog
(
nomadLogsInstance
.
getErrorMessage
(),
"viewLogsMessage"
);
// // waiting for a real "is running" status (see YLG)
// nomadLogsInstance.waitFor(State.RUNNING);
// System.out.println(nomadLogsInstance + " started");
}
catch
(
StartException
e
)
{
DialogManager
.
getInstance
().
nomadMessageDialog
(
e
.
getMessage
(),
"viewLogsMessage"
);
}
}
else
{
...
...
@@ -765,7 +767,7 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
private
boolean
nomadLogsIsOpen
()
{
if
(
cameoServer
!=
null
)
{
nomadLogsInstance
=
cameoServer
.
connect
(
NOMADLOGS_APP_NAME
);
return
(
nomadLogsInstance
.
exists
()
);
return
(
nomadLogsInstance
!=
null
);
}
return
false
;
}
...
...
@@ -774,7 +776,7 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
private
boolean
nomadSurveyIsOpen
()
{
if
(
cameoServer
!=
null
)
{
nomadSurveyInstance
=
cameoServer
.
connect
(
NOMADSURVEY_APP_NAME
);
return
(
nomadSurveyInstance
.
exists
()
);
return
(
nomadSurveyInstance
!=
null
);
}
return
false
;
}
...
...
@@ -860,7 +862,8 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
if
(
cameoServer
==
null
)
{
String
serverLocation
=
ConfigManager
.
getInstance
().
getServerEndpoint
();
if
(
serverLocation
!=
null
)
{
cameoServer
=
new
Server
(
serverLocation
);
cameoServer
=
Server
.
create
(
serverLocation
);
cameoServer
.
init
();
}
}
if
(
cameoServer
!=
null
)
{
...
...
@@ -882,11 +885,12 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
for
(
String
arg:
args
)
{
System
.
out
.
println
(
"arg "
+
arg
);
}
nomadSurveyInstance
=
cameoServer
.
start
(
NOMADSURVEY_APP_NAME
,
args
);
if
(
nomadSurveyInstance
.
exists
())
{
try
{
nomadSurveyInstance
=
cameoServer
.
start
(
NOMADSURVEY_APP_NAME
,
args
);
System
.
out
.
println
(
"Starting "
+
nomadSurveyInstance
);
}
else
if
(
nomadSurveyInstance
.
getErrorMessage
()
!=
null
)
{
DialogManager
.
getInstance
().
nomadMessageDialog
(
nomadSurveyInstance
.
getError
Message
(),
"viewSurveyTitle"
);
}
catch
(
StartException
e
)
{
DialogManager
.
getInstance
().
nomadMessageDialog
(
e
.
get
Message
(),
"viewSurveyTitle"
);
}
}
else
{
...
...
src/main/java/fr/ill/ics/client/control/command/CommandWindow.java
View file @
8fb8e81a
...
...
@@ -30,8 +30,9 @@ import fr.ill.ics.bridge.LoginManager;
import
fr.ill.ics.bridge.ResourceManager
;
import
fr.ill.ics.bridge.command.CommandZoneWrapper
;
import
fr.ill.ics.bridge.commandline.CommandLineProxyWrapper
;
import
fr.ill.ics.cameo.Application.Instance
;
import
fr.ill.ics.cameo.Server
;
import
fr.ill.ics.cameo.base.App
;
import
fr.ill.ics.cameo.base.Server
;
import
fr.ill.ics.cameo.base.StartException
;
import
fr.ill.ics.client.control.MainWindow
;
import
fr.ill.ics.client.control.command.content.CommandBox
;
import
fr.ill.ics.client.control.command.content.ForLoopCommandZone
;
...
...
@@ -83,10 +84,10 @@ public class CommandWindow {
private
boolean
appendingToServerTab
=
false
;
private
Map
<
String
,
Instance
>
simulatedServers
=
new
ConcurrentHashMap
<
String
,
Instance
>();
private
Map
<
String
,
App
>
simulatedServers
=
new
ConcurrentHashMap
<
String
,
App
>();
private
Server
cameoServer
;
private
Instance
simulatedServer
;
private
App
simulatedServer
;
protected
CommandWindow
()
{
}
...
...
@@ -467,14 +468,15 @@ public class CommandWindow {
String
nomadServerLocation
=
ServerInstance
.
getInstance
().
getNomadServerEndpoint
();
if
(
nomadServerLocation
!=
null
)
{
cameoServer
=
new
Server
(
nomadServerLocation
);
cameoServer
=
Server
.
create
(
nomadServerLocation
);
cameoServer
.
init
();
}
}
if
(
cameoServer
!=
null
)
{
simulatedServer
=
cameoServer
.
start
(
SIMULATION_APPLICATION_NAME
);
try
{
simulatedServer
=
cameoServer
.
start
(
SIMULATION_APPLICATION_NAME
);
if
(
simulatedServer
.
exists
())
{
System
.
out
.
println
(
"Starting "
+
simulatedServer
);
String
serverId
=
simulatedServer
.
getId
()+
""
;
...
...
@@ -503,7 +505,9 @@ public class CommandWindow {
}
else
{
DialogManager
.
getInstance
().
nomadMessageDialog
(
"cameoUnableToStartSimulationServerMessage"
,
"cameoErrorTitle"
);
}
}
}
catch
(
StartException
e
)
{
DialogManager
.
getInstance
().
nomadMessageDialog
(
e
.
getMessage
(),
"cameoErrorTitle"
);
}
}
else
{
DialogManager
.
getInstance
().
nomadMessageDialog
(
"unableToLocateNomadServerPropertyMessage"
,
"configurationErrorMessage"
);
}
...
...
@@ -515,7 +519,7 @@ public class CommandWindow {
public
void
stopSimulationServerForId
(
String
serverId
)
{
MainWindowPeer
.
getInstance
().
setCursorToWait
();
Instance
simulatedServer
=
simulatedServers
.
get
(
serverId
);
App
simulatedServer
=
simulatedServers
.
get
(
serverId
);
if
(
simulatedServer
!=
null
)
{
System
.
out
.
println
(
"Killing "
+
simulatedServer
.
getNameId
());
simulatedServer
.
kill
();
...
...
src/main/java/fr/ill/ics/client/control/startup/Startup.java
View file @
8fb8e81a
...
...
@@ -24,7 +24,7 @@ import java.io.IOException;
import
fr.ill.ics.bridge.LoginManager
;
import
fr.ill.ics.bridge.command.CommandZoneWrapper
;
import
fr.ill.ics.cameo.
Application
;
import
fr.ill.ics.cameo.
base.This
;
import
fr.ill.ics.client.control.MainWindow
;
import
fr.ill.ics.client.control.command.CommandWindow
;
import
fr.ill.ics.client.control.login.ServerConnection
;
...
...
@@ -94,7 +94,7 @@ public class Startup {
MainWindowPeer
.
setRefresh
(
false
);
Application
.
This
.
init
(
"nomadgui"
,
ConfigManager
.
getInstance
().
getServerEndpoint
());
This
.
init
(
"nomadgui"
,
ConfigManager
.
getInstance
().
getServerEndpoint
());
ServerInstance
.
getInstance
().
init
();
// Save the session information: the server endpoint is serialised so that in case the client is running on a VISA instance and crashes,
...
...
src/main/java/fr/ill/ics/client/standalone/NomadLite.java
View file @
8fb8e81a
...
...
@@ -21,7 +21,7 @@ package fr.ill.ics.client.standalone;
import
fr.ill.ics.bridge.ChangeManager
;
import
fr.ill.ics.bridge.LoginManager
;
import
fr.ill.ics.bridge.command.CommandZoneWrapper
;
import
fr.ill.ics.cameo.
Application
;
import
fr.ill.ics.cameo.
base.This
;
import
fr.ill.ics.client.control.MainWindow
;
import
fr.ill.ics.client.control.command.CommandWindow
;
import
fr.ill.ics.client.control.command.CommandWindowLite
;
...
...
@@ -73,7 +73,7 @@ public class NomadLite {
public
void
init
()
{
ConfigManager
.
initInstance
(
""
);
Nomad
.
setLite
();
Application
.
This
.
init
(
"nomadgui"
,
ConfigManager
.
getInstance
().
getServerEndpoint
());
This
.
init
(
"nomadgui"
,
ConfigManager
.
getInstance
().
getServerEndpoint
());
ServerInstance
.
getInstance
().
init
();
ServerConnection
login
=
new
ServerConnection
();
...
...
src/main/java/fr/ill/ics/client/test/TestClientConfiguration.java
View file @
8fb8e81a
...
...
@@ -28,7 +28,7 @@ import java.util.Set;
import
org.eclipse.swt.widgets.Tree
;
import
org.eclipse.swt.widgets.TreeItem
;
import
fr.ill.ics.cameo.
Application
;
import
fr.ill.ics.cameo.
base.This
;
import
fr.ill.ics.client.control.MainWindow
;
import
fr.ill.ics.client.control.command.CommandWindow
;
import
fr.ill.ics.client.control.parser.ControllerCommandViewParser
;
...
...
@@ -79,7 +79,7 @@ public class TestClientConfiguration {
exitCode
=
e
.
getExitCode
();
}
finally
{
Application
.
This
.
terminate
();
This
.
terminate
();
System
.
out
.
println
(
"Terminated Cameo application"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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