Search in sources :

Example 1 with Statistics

use of org.yamcs.protobuf.YamcsManagement.Statistics 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));
    }
}
Also used : ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) YamcsInstance(org.yamcs.protobuf.YamcsManagement.YamcsInstance) ConnectionInfo(org.yamcs.protobuf.Web.ConnectionInfo) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo) Statistics(org.yamcs.protobuf.YamcsManagement.Statistics)

Example 2 with Statistics

use of org.yamcs.protobuf.YamcsManagement.Statistics 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");
    }
}
Also used : ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) ManagementListener(org.yamcs.studio.core.model.ManagementListener) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo) ConnectionInfo(org.yamcs.protobuf.Web.ConnectionInfo) Statistics(org.yamcs.protobuf.YamcsManagement.Statistics)

Aggregations

ConnectionInfo (org.yamcs.protobuf.Web.ConnectionInfo)2 ClientInfo (org.yamcs.protobuf.YamcsManagement.ClientInfo)2 ProcessorInfo (org.yamcs.protobuf.YamcsManagement.ProcessorInfo)2 Statistics (org.yamcs.protobuf.YamcsManagement.Statistics)2 YamcsInstance (org.yamcs.protobuf.YamcsManagement.YamcsInstance)1 ManagementListener (org.yamcs.studio.core.model.ManagementListener)1