|
13 | 13 | * |
14 | 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 |
15 | 15 | ********************************************************************************/ |
| 16 | +import 'reflect-metadata'; |
| 17 | + |
16 | 18 | import { configureELKLayoutModule } from '@eclipse-glsp/layout-elk'; |
17 | | -import { |
18 | | - createAppModule, |
19 | | - GModelStorage, |
20 | | - Logger, |
21 | | - LoggerFactory, |
22 | | - SocketServerLauncher, |
23 | | - WebSocketServerLauncher |
24 | | -} from '@eclipse-glsp/server/node'; |
| 19 | +import { createAppModule, GModelStorage, SocketServerLauncher, WebSocketServerLauncher } from '@eclipse-glsp/server/node'; |
25 | 20 | import { Container } from 'inversify'; |
| 21 | + |
26 | 22 | import { WorkflowLayoutConfigurator } from '../common/layout/workflow-layout-configurator'; |
27 | 23 | import { WorkflowDiagramModule, WorkflowServerModule } from '../common/workflow-diagram-module'; |
28 | 24 | import { createWorkflowCliParser } from './workflow-cli-parser'; |
29 | 25 |
|
30 | | -export async function launch(argv?: string[]): Promise<void> { |
31 | | - let logger: Logger | undefined; |
32 | | - try { |
33 | | - const options = createWorkflowCliParser().parse(argv); |
34 | | - const appContainer = new Container(); |
35 | | - appContainer.load(createAppModule(options)); |
| 26 | +async function launch(argv?: string[]): Promise<void> { |
| 27 | + const options = createWorkflowCliParser().parse(argv); |
| 28 | + const appContainer = new Container(); |
| 29 | + appContainer.load(createAppModule(options)); |
36 | 30 |
|
37 | | - logger = appContainer.get<LoggerFactory>(LoggerFactory)('WorkflowServerApp'); |
| 31 | + const elkLayoutModule = configureELKLayoutModule({ algorithms: ['layered'], layoutConfigurator: WorkflowLayoutConfigurator }); |
| 32 | + const serverModule = new WorkflowServerModule().configureDiagramModule(new WorkflowDiagramModule(() => GModelStorage), elkLayoutModule); |
38 | 33 |
|
39 | | - const elkLayoutModule = configureELKLayoutModule({ algorithms: ['layered'], layoutConfigurator: WorkflowLayoutConfigurator }); |
40 | | - const serverModule = new WorkflowServerModule().configureDiagramModule( |
41 | | - new WorkflowDiagramModule(() => GModelStorage), |
42 | | - elkLayoutModule |
43 | | - ); |
44 | | - |
45 | | - if (options.webSocket) { |
46 | | - const launcher = appContainer.resolve(WebSocketServerLauncher); |
47 | | - launcher.configure(serverModule); |
48 | | - launcher.start({ port: options.port, host: options.host, path: 'workflow' }); |
49 | | - } else { |
50 | | - const launcher = appContainer.resolve(SocketServerLauncher); |
51 | | - launcher.configure(serverModule); |
52 | | - launcher.start({ port: options.port, host: options.host }); |
53 | | - } |
54 | | - } catch (error) { |
55 | | - (logger ?? console).error('Error in workflow server launcher:', error); |
| 34 | + if (options.webSocket) { |
| 35 | + const launcher = appContainer.resolve(WebSocketServerLauncher); |
| 36 | + launcher.configure(serverModule); |
| 37 | + launcher.start({ port: options.port, host: options.host, path: 'workflow' }); |
| 38 | + } else { |
| 39 | + const launcher = appContainer.resolve(SocketServerLauncher); |
| 40 | + launcher.configure(serverModule); |
| 41 | + launcher.start({ port: options.port, host: options.host }); |
56 | 42 | } |
57 | 43 | } |
| 44 | + |
| 45 | +launch(process.argv).catch(error => console.error('Error in workflow server launcher:', error)); |
0 commit comments