Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public class ServerParams {
public static final String STAT = "CmdStat";
public static final String GET_USER_INFO = "CmdGetUserInfo";
public static final String GET_ALERTS = "CmdAlerts";
public static final String GET_VERSION = "CmdVersion";

public static final String JSON_DATA = "JsonData";
public static final String RESOLVE_NAME= "CmdResolveName";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import edu.caltech.ipac.firefly.data.ServerParams;
import edu.caltech.ipac.firefly.data.userdata.UserInfo;
import edu.caltech.ipac.firefly.messaging.JsonHelper;
import edu.caltech.ipac.firefly.server.util.VersionUtil;
import edu.caltech.ipac.util.KeyVal;
import edu.caltech.ipac.util.serialization.Serializer;
import edu.caltech.ipac.firefly.server.events.FluxAction;
import edu.caltech.ipac.firefly.server.events.ServerEventManager;
import edu.caltech.ipac.firefly.server.security.SsoAdapter;
Expand All @@ -24,6 +27,7 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -150,6 +154,23 @@ public String doCommand(SrvParam params) throws Exception {



public static class GetVersion extends ServCommand {
public String doCommand(SrvParam params) throws Exception {
boolean raw = params.getOptionalBoolean("raw", false);
Object versionData;
if (raw) {
versionData = VersionUtil.getAppVersion();
} else {
Map<String, String> versionMap = new LinkedHashMap<>();
for (KeyVal<String, String> kv : VersionUtil.getVersionInfo()) {
versionMap.put(kv.getKey(), kv.getValue());
}
versionData = versionMap;
}
return Serializer.getJsonMapper().writeValueAsString(versionData);
}
}

public static class GetAlerts extends ServCommand {
public String doCommand(SrvParam params) throws Exception {
Alert alert= AlertsMonitor.checkAlerts(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ private static void initCommand() {
_cmdMap.put(ServerParams.LOGOUT, new AppServerCommands.Logout());
_cmdMap.put(ServerParams.GET_USER_INFO, new AppServerCommands.GetUserInfo());
_cmdMap.put(ServerParams.GET_ALERTS, new AppServerCommands.GetAlerts());
_cmdMap.put(ServerParams.GET_VERSION, new AppServerCommands.GetVersion());
_cmdMap.put(ServerParams.TEXT_FILE, new AppServerCommands.TextFile());

}
Expand Down