Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static readonly startedServerState: ServerStateNode = {
deployableStates: [ProtocolStubs.deployableStateNode],
publishState: ServerState.PUBLISH_STATE_UNKNOWN,
server: ProtocolStubs.serverHandle,
runMode: ServerState.RUN_MODE_RUN,
state: ServerState.STARTED,
rsp: 'id'
};
public static readonly stoppedServerState: ServerStateNode = {
deployableStates: [],
publishState: ServerState.PUBLISH_STATE_UNKNOWN,
server: ProtocolStubs.serverHandle,
runMode: ServerState.RUN_MODE_RUN,
state: ServerState.STOPPED,
rsp: 'id'
};
public static readonly javaCommandLine: Protocol.CommandLineDetails = {
cmdLine: [],
workingDir: '',
envp: [],
properties: {
['debug.details.type']: 'java',
['debug.details.port']: 'javaPort'
}
};
public static readonly rspType: RSPType = {
id: 'id',
visibilename: 'the type'
const serverFilter = server => server.state === ServerState.STOPPED || server.state === ServerState.UNKNOWN;
const serverId = await this.selectServer(rsp.id, 'Select server to start.', serverFilter);
public async runOnServer(uri: vscode.Uri, mode?: string): Promise {
if (!this.explorer) {
return Promise.reject('Runtime Server Protocol (RSP) Server is starting, please try again later.');
}
const rsp = await this.selectRSP('Select RSP provider you want to retrieve servers');
if (!rsp || !rsp.id) return;
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.`);
}
}