@eclipse-emfcloud/modelserver-theia
Version:
## Typescript Client API
71 lines • 3.57 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
/********************************************************************************
* Copyright (c) 2019-2022 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0, or the MIT License which is
* available at https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: EPL-2.0 OR MIT
*******************************************************************************/
import { BackendApplicationContribution } from '@theia/core/lib/node';
import { ProcessErrorEvent } from '@theia/process/lib/node/process';
import { ProcessManager } from '@theia/process/lib/node/process-manager';
import { RawProcess, RawProcessFactory } from '@theia/process/lib/node/raw-process';
import * as cp from 'child_process';
import { TheiaModelServerClient, TheiaModelServerClientV2 } from '../common';
import { LaunchOptions } from './launch-options';
export declare const ModelServerLauncher: unique symbol;
export interface ModelServerLauncher {
startServer(): boolean;
dispose(): void;
}
export declare class DefaultModelServerLauncher implements ModelServerLauncher, BackendApplicationContribution {
protected readonly launchOptions: LaunchOptions;
protected readonly processFactory: RawProcessFactory;
protected readonly processManager: ProcessManager;
protected readonly modelserverClient: TheiaModelServerClient | TheiaModelServerClientV2;
initialize(): Promise<void>;
startServer(): boolean;
protected doStartServer(): void;
/**
* Resolve the TCP port number that the Java server should be configured to listen on.
*
* @param options the launch options
* @returns the most appropriate port number to configure the Java server process to listen on
*/
protected resolveJavaServerPort(options: LaunchOptions): number;
protected validateLaunch(): boolean;
protected spawnProcessAsync(command: string, args?: string[], options?: cp.SpawnOptions): Promise<RawProcess>;
protected onDidFailSpawnProcess(error: Error | ProcessErrorEvent): void;
protected logError(data: string | Buffer): void;
protected logInfo(data: string | Buffer): void;
dispose(): void;
onStop(): void;
}
export declare class DefaultModelServerNodeLauncher extends DefaultModelServerLauncher {
protected readonly launchOptions: LaunchOptions;
protected readonly modelserverClient: TheiaModelServerClientV2;
validateLaunch(): boolean;
protected doStartServer(): void;
protected startJavaServer(): void;
protected resolveJavaServerPort(options: LaunchOptions): number;
protected startNodeServer(): void;
/**
* Resolve the TCP port number that the Node server should be configured to address its upstream Java server.
*
* @param options the launch options
* @returns the most appropriate port number to configure the Node server process to connect to for the upstream Java server
*/
protected resolveUpstreamPort(options: LaunchOptions): number;
/**
* Resolve the TCP port number that the Node server should be configured to listen on.
*
* @param options the launch options
* @returns the most appropriate port number to configure the Node server process to listen on
*/
protected resolveNodeServerPort(options: LaunchOptions): number;
}
//# sourceMappingURL=model-server-backend-contribution.d.ts.map