mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 09:35:38 -05:00
46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
import { ITool } from '../interfaces';
|
|
import { DockerTool } from './tools/dockerTool';
|
|
import { AzCliTool } from './tools/azCliTool';
|
|
import { AzdataTool } from './tools/azdataTool';
|
|
import { KubeCtlTool } from './tools/kubeCtlTool';
|
|
import { IPlatformService } from './platformService';
|
|
import { AzdataToolOld } from './tools/azdataToolOld';
|
|
|
|
export interface IToolsService {
|
|
getToolByName(toolName: string): ITool | undefined;
|
|
toolsForCurrentProvider: ITool[];
|
|
}
|
|
|
|
export class ToolsService implements IToolsService {
|
|
private supportedTools: Map<string, ITool>;
|
|
private currentTools: ITool[] = [];
|
|
|
|
constructor(private _platformService: IPlatformService) {
|
|
this.supportedTools = new Map<string, ITool>(
|
|
[
|
|
new DockerTool(this._platformService),
|
|
new AzCliTool(this._platformService),
|
|
new AzdataTool(this._platformService),
|
|
new AzdataToolOld(this._platformService),
|
|
new KubeCtlTool(this._platformService)
|
|
].map<[string, ITool]>((tool: ITool) => [tool.name, tool])
|
|
);
|
|
}
|
|
|
|
getToolByName(toolName: string): ITool | undefined {
|
|
return this.supportedTools.get(toolName);
|
|
}
|
|
|
|
get toolsForCurrentProvider(): ITool[] {
|
|
return this.currentTools;
|
|
}
|
|
|
|
set toolsForCurrentProvider(tools: ITool[]) {
|
|
this.currentTools = tools;
|
|
}
|
|
}
|