How to use the rsp-client.ServerState.RUN_MODE_RUN 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
public static readonly serverType: Protocol.ServerType = {
        id: 'type',
        description: 'a type',
        visibleName: 'the type'
    };

    public static readonly serverHandle: Protocol.ServerHandle = {
        id: 'id',
        type: ProtocolStubs.serverType
    };

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

    public static readonly serverDebuggingState: ServerStateNode =  {
        server: ProtocolStubs.serverHandle,
        deployableStates: [],
        publishState: 0,
        runMode: ServerState.RUN_MODE_DEBUG,
        state: 2,
        rsp: 'id'
    };

    public static readonly okStatus: Protocol.Status = {
        code: 0,
        message: 'ok',
        severity: 0,
github redhat-developer / vscode-rsp-ui / test / protocolstubs.ts View on Github external
};

    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'
    };

    public static readonly deployableStateNode: DeployableStateNode = {
        rsp: 'id',
        publishState: ServerState.PUBLISH_STATE_UNKNOWN,
        server: ProtocolStubs.serverHandle,
        state: ServerState.STARTED,
        reference: ProtocolStubs.deployableReference
    };
github redhat-developer / vscode-rsp-ui / src / extensionApi.ts View on Github external
if (!serverId) return;
        const context = this.explorer.getServerStateById(rsp.id, serverId);

        await this.explorer.addDeployment([uri], context);
        const isAsync = vscode.workspace.getConfiguration('rsp-ui').get(`enableAsyncPublish`);
        await this.explorer.publish(rsp.id, context.server, ServerState.PUBLISH_FULL, isAsync);
        if (context.state === ServerState.STOPPED ||
            context.state === ServerState.UNKNOWN) {
            if (mode === ServerState.RUN_MODE_RUN) {
                await this.startServer(mode, context);
            } else {
                await this.debugServer(context);
            }
        } else if (context.state === ServerState.STARTED) {
            if (!(context.runMode === ServerState.RUN_MODE_RUN &&
                mode === ServerState.RUN_MODE_RUN)) {
                await this.restartServer(mode, context);
            }
        } else {
            return Promise.reject(`Unable to add deployment and run it on server ${context.server.id}. Stop/start the server and try again.`);
        }
    }
github redhat-developer / vscode-rsp-ui / src / extensionApi.ts View on Github external
const serverId = await this.selectServer(rsp.id, 'Select server you want to retrieve info about');
        if (!serverId) return;
        const context = this.explorer.getServerStateById(rsp.id, serverId);

        await this.explorer.addDeployment([uri], context);
        const isAsync = vscode.workspace.getConfiguration('rsp-ui').get(`enableAsyncPublish`);
        await this.explorer.publish(rsp.id, context.server, ServerState.PUBLISH_FULL, isAsync);
        if (context.state === ServerState.STOPPED ||
            context.state === ServerState.UNKNOWN) {
            if (mode === ServerState.RUN_MODE_RUN) {
                await this.startServer(mode, context);
            } else {
                await this.debugServer(context);
            }
        } else if (context.state === ServerState.STARTED) {
            if (!(context.runMode === ServerState.RUN_MODE_RUN &&
                mode === ServerState.RUN_MODE_RUN)) {
                await this.restartServer(mode, context);
            }
        } else {
            return Promise.reject(`Unable to add deployment and run it on server ${context.server.id}. Stop/start the server and try again.`);
        }
    }