use of org.yamcs.protobuf.Web.ConnectionInfo in project yamcs-studio by yamcs.
the class ManagementCatalogue method onMessage.
@Override
public void onMessage(WebSocketSubscriptionData msg) {
if (msg.hasConnectionInfo()) {
ConnectionInfo connectionInfo = msg.getConnectionInfo();
YamcsInstance instance = connectionInfo.getInstance();
log.fine("Instance " + instance.getName() + ": " + instance.getState());
managementListeners.forEach(l -> l.instanceUpdated(connectionInfo));
}
if (msg.hasClientInfo()) {
ClientInfo clientInfo = msg.getClientInfo();
if (clientInfo.getState() == ClientState.DISCONNECTED) {
ClientInfo previousClientInfo = clientInfoById.remove(clientInfo.getId());
checkOwnClientState(previousClientInfo, clientInfo);
managementListeners.forEach(l -> l.clientDisconnected(clientInfo));
} else {
ClientInfo previousClientInfo = clientInfoById.put(clientInfo.getId(), clientInfo);
checkOwnClientState(previousClientInfo, clientInfo);
managementListeners.forEach(l -> l.clientUpdated(clientInfo));
}
}
if (msg.hasProcessorInfo()) {
ProcessorInfo processorInfo = msg.getProcessorInfo();
String instance = processorInfo.getInstance();
Map<String, ProcessorInfo> instanceProcessors = processorInfoByInstance.get(instance);
if (instanceProcessors == null) {
instanceProcessors = new ConcurrentHashMap<>();
processorInfoByInstance.put(instance, instanceProcessors);
}
if (processorInfo.getState() == ServiceState.TERMINATED) {
instanceProcessors.remove(processorInfo.getName());
} else {
instanceProcessors.put(processorInfo.getName(), processorInfo);
}
managementListeners.forEach(l -> l.processorUpdated(processorInfo));
}
if (msg.hasStatistics()) {
Statistics statistics = msg.getStatistics();
managementListeners.forEach(l -> l.statisticsUpdated(statistics));
}
}
use of org.yamcs.protobuf.Web.ConnectionInfo in project yamcs-studio by yamcs.
the class YamcsUIPlugin method postWorkbenchStartup.
/**
* Hook called by application layer to bootstrap connection state
*/
public void postWorkbenchStartup(IWorkbench workbench) {
// Listen to processing-info updates
// Trigger initial state
doUpdateGlobalProcessingState(workbench, null);
ManagementCatalogue.getInstance().addManagementListener(new ManagementListener() {
@Override
public void processorUpdated(ProcessorInfo processorInfo) {
updateGlobalProcessingState(processorInfo);
}
@Override
public void processorClosed(ProcessorInfo processorInfo) {
updateGlobalProcessingState(processorInfo);
}
@Override
public void statisticsUpdated(Statistics stats) {
}
@Override
public void clientUpdated(ClientInfo clientInfo) {
updateGlobalProcessingState(clientInfo);
}
@Override
public void clientDisconnected(ClientInfo clientInfo) {
updateGlobalProcessingState(clientInfo);
}
@Override
public void instanceUpdated(ConnectionInfo connectionInfo) {
}
@Override
public void clearAllManagementData() {
}
});
// Request connection to Yamcs server
boolean singleConnectionMode = getPreferenceStore().getBoolean("singleConnectionMode");
if (!singleConnectionMode && ConnectionPreferences.isAutoConnect()) {
RCPUtils.runCommand("org.yamcs.studio.core.ui.autoconnect");
}
}
Aggregations