How to use the rsp-client.ServerState.UNKNOWN function in rsp-client

To help you get started, we’ve selected a few rsp-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github redhat-developer / vscode-rsp-ui / test / protocolstubs.ts View on Github external
workingDir: '',
        envp: [],
        properties: {
            ['debug.details.type']: 'java',
            ['debug.details.port']: 'javaPort'
        }
    };

    public static readonly rspType: RSPType = {
        id: 'id',
        visibilename: 'the type'
    };

    public static readonly rspState: RSPState = {
        serverStates: [ProtocolStubs.startedServerState],
        state: ServerState.UNKNOWN,
        type: ProtocolStubs.rspType
    };

    public static readonly rspProperties: RSPProperties = {
        client: undefined,
        rspserverstderr: undefined,
        rspserverstdout: undefined,
        state: ProtocolStubs.rspState
    };

    public static readonly rspStateStarted: RSPState = {
        serverStates: [],
        state: ServerState.STARTED,
        type: ProtocolStubs.rspType
    };
github redhat-developer / vscode-rsp-ui / test / protocolstubs.ts View on Github external
public static readonly okStartServerResponse: Protocol.StartServerResponse = {
        details: ProtocolStubs.cmdDetails,
        status: ProtocolStubs.okStatus
    };

    public static readonly errorStartServerResponse: Protocol.StartServerResponse = {
        details: ProtocolStubs.cmdDetails,
        status: ProtocolStubs.errorStatus
    };

    public static readonly unknownServerState: ServerStateNode =  {
        server: ProtocolStubs.serverHandle,
        deployableStates: [],
        publishState: ServerState.PUBLISH_STATE_UNKNOWN,
        runMode: ServerState.RUN_MODE_RUN,
        state: ServerState.UNKNOWN,
        rsp: 'id'
    };

    public static readonly startedServerStateProtocol: Protocol.ServerState = {
        deployableStates: [],
        publishState: ServerState.PUBLISH_STATE_UNKNOWN,
        server: ProtocolStubs.serverHandle,
        runMode: ServerState.RUN_MODE_RUN,
        state: ServerState.STARTED
    };

    public static readonly deployableReference: Protocol.DeployableReference = {
        label: 'fake',
        path: 'fakepath'
    };
github redhat-developer / vscode-rsp-ui / src / extensionApi.ts View on Github external
            const serverFilter = server => server.state === ServerState.STOPPED || server.state === ServerState.UNKNOWN;
            const serverId = await this.selectServer(rsp.id, 'Select server to start.', serverFilter);
github redhat-developer / vscode-rsp-ui / src / extensionApi.ts View on Github external
public async startServer(mode: string, context?: ServerStateNode): Promise {
        if (context === undefined) {
            const rsp = await this.selectRSP('Select RSP provider you want to retrieve servers');
            if (!rsp || !rsp.id) return null;
            const serverFilter = server => server.state === ServerState.STOPPED || server.state === ServerState.UNKNOWN;
            const serverId = await this.selectServer(rsp.id, 'Select server to start.', serverFilter);
            if (!serverId) return null;
            context = this.explorer.getServerStateById(rsp.id, serverId);
        }

        const serverState = this.explorer.getServerStateById(context.rsp, context.server.id).state;
        if (!(serverState === ServerState.STOPPED
            || serverState === ServerState.UNKNOWN)) {
            return Promise.reject('The server is already running.');
        }

        const client: RSPClient = this.explorer.getClientByRSP(context.rsp);
        if (!client) {
            return Promise.reject('Failed to contact the RSP server.');
        }

        const response = await client.getOutgoingHandler().startServerAsync({
            params: {
                serverType: context.server.type.id,
                id: context.server.id,
                attributes: new Map()
            },
            mode: mode
        });