Update product references from 'sqlops' to 'azdata' (#4259)

* Update extensions to use azdata

* Switch core code to use azdata
This commit is contained in:
Karl Burtram
2019-03-01 13:59:37 -08:00
committed by GitHub
parent 220685a522
commit 84890eb1b4
371 changed files with 3208 additions and 3184 deletions

View File

@@ -5,7 +5,7 @@
'use strict';
import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
@@ -42,7 +42,7 @@ export interface ICommandViewContext extends ICommandBaseContext {
export interface ICommandObjectExplorerContext extends ICommandBaseContext {
type: 'objectexplorer';
explorerContext: sqlops.ObjectExplorerContext;
explorerContext: azdata.ObjectExplorerContext;
}
export type CommandContext = ICommandObjectExplorerContext | ICommandViewContext | ICommandUriContext | ICommandUnknownContext;
@@ -115,7 +115,7 @@ export abstract class Command extends vscode.Disposable {
}
if (firstArg && utils.isObjectExplorerContext(firstArg)) {
const [explorerContext, ...rest] = args as [sqlops.ObjectExplorerContext, any];
const [explorerContext, ...rest] = args as [azdata.ObjectExplorerContext, any];
return [{ command: command, type: constants.ObjectExplorerService, explorerContext: explorerContext }, rest];
}

View File

@@ -5,7 +5,7 @@
'use strict';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
@@ -13,14 +13,14 @@ import * as constants from '../constants';
import { IFileSource, IHdfsOptions, IRequestParams, FileSourceFactory } from './fileSources';
export class SqlClusterConnection {
private _connection: sqlops.connection.Connection;
private _profile: sqlops.IConnectionProfile;
private _connection: azdata.connection.Connection;
private _profile: azdata.IConnectionProfile;
private _host: string;
private _port: string;
private _user: string;
private _password: string;
constructor(connectionInfo: sqlops.connection.Connection | sqlops.IConnectionProfile) {
constructor(connectionInfo: azdata.connection.Connection | azdata.IConnectionProfile) {
this.validate(connectionInfo);
if ('id' in connectionInfo) {
@@ -36,14 +36,14 @@ export class SqlClusterConnection {
this._password = this._connection.options[constants.passwordPropName];
}
public get connection(): sqlops.connection.Connection { return this._connection; }
public get profile(): sqlops.IConnectionProfile { return this._profile; }
public get connection(): azdata.connection.Connection { return this._connection; }
public get profile(): azdata.IConnectionProfile { return this._profile; }
public get host(): string { return this._host; }
public get port(): number { return this._port ? Number.parseInt(this._port) : constants.defaultKnoxPort; }
public get user(): string { return this._user; }
public get password(): string { return this._password; }
public isMatch(connection: SqlClusterConnection | sqlops.ConnectionInfo): boolean {
public isMatch(connection: SqlClusterConnection | azdata.ConnectionInfo): boolean {
if (!connection) { return false; }
let options1 = connection instanceof SqlClusterConnection ?
connection._connection.options : connection.options;
@@ -69,7 +69,7 @@ export class SqlClusterConnection {
return FileSourceFactory.instance.createHdfsFileSource(options);
}
private validate(connectionInfo: sqlops.ConnectionInfo): void {
private validate(connectionInfo: azdata.ConnectionInfo): void {
if (!connectionInfo) {
throw new Error(localize('connectionInfoUndefined', 'ConnectionInfo is undefined.'));
}
@@ -84,7 +84,7 @@ export class SqlClusterConnection {
}
}
private getMissingProperties(connectionInfo: sqlops.ConnectionInfo): string[] {
private getMissingProperties(connectionInfo: azdata.ConnectionInfo): string[] {
if (!connectionInfo || !connectionInfo.options) { return undefined; }
return [
constants.hostPropName, constants.knoxPortPropName,
@@ -92,15 +92,15 @@ export class SqlClusterConnection {
].filter(e => connectionInfo.options[e] === undefined);
}
private toConnection(connProfile: sqlops.IConnectionProfile): sqlops.connection.Connection {
let connection: sqlops.connection.Connection = Object.assign(connProfile,
private toConnection(connProfile: azdata.IConnectionProfile): azdata.connection.Connection {
let connection: azdata.connection.Connection = Object.assign(connProfile,
{ connectionId: this._profile.id });
return connection;
}
private toConnectionProfile(connectionInfo: sqlops.connection.Connection): sqlops.IConnectionProfile {
private toConnectionProfile(connectionInfo: azdata.connection.Connection): azdata.IConnectionProfile {
let options = connectionInfo.options;
let connProfile: sqlops.IConnectionProfile = Object.assign(<sqlops.IConnectionProfile>{},
let connProfile: azdata.IConnectionProfile = Object.assign(<azdata.IConnectionProfile>{},
connectionInfo,
{
serverName: `${options[constants.hostPropName]},${options[constants.knoxPortPropName]}`,

View File

@@ -6,7 +6,7 @@
'use strict';
import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
import * as fs from 'fs';
import * as fspath from 'path';
import * as clipboardy from 'clipboardy';
@@ -92,7 +92,7 @@ export class UploadFilesCommand extends ProgressCommand {
localize('uploading', 'Uploading files to HDFS'), true,
() => this.apiWrapper.showInformationMessage(localize('uploadCanceled', 'Upload operation was canceled')));
if (context.type === constants.ObjectExplorerService) {
let objectExplorerNode = await sqlops.objectexplorer.getNode(context.explorerContext.connectionProfile.id, folderNode.getNodeInfo().nodePath);
let objectExplorerNode = await azdata.objectexplorer.getNode(context.explorerContext.connectionProfile.id, folderNode.getNodeInfo().nodePath);
await objectExplorerNode.refresh();
}
}
@@ -150,7 +150,7 @@ export class MkDirCommand extends ProgressCommand {
localize('makingDir', 'Creating directory'), true,
() => this.apiWrapper.showInformationMessage(localize('mkdirCanceled', 'Operation was canceled')));
if (context.type === constants.ObjectExplorerService) {
let objectExplorerNode = await sqlops.objectexplorer.getNode(context.explorerContext.connectionProfile.id, folderNode.getNodeInfo().nodePath);
let objectExplorerNode = await azdata.objectexplorer.getNode(context.explorerContext.connectionProfile.id, folderNode.getNodeInfo().nodePath);
await objectExplorerNode.refresh();
}
}
@@ -191,9 +191,9 @@ export class DeleteFilesCommand extends Command {
// TODO ideally would let node define if it's deletable
// TODO also, would like to change this to getNodeInfo as OE is the primary use case now
let treeItem = await node.getTreeItem();
let oeNodeToRefresh: sqlops.objectexplorer.ObjectExplorerNode = undefined;
let oeNodeToRefresh: azdata.objectexplorer.ObjectExplorerNode = undefined;
if (context.type === constants.ObjectExplorerService) {
let oeNodeToDelete = await sqlops.objectexplorer.getNode(context.explorerContext.connectionProfile.id, node.getNodeInfo().nodePath);
let oeNodeToDelete = await azdata.objectexplorer.getNode(context.explorerContext.connectionProfile.id, node.getNodeInfo().nodePath);
oeNodeToRefresh = await oeNodeToDelete.getParent();
}
switch (treeItem.contextValue) {

View File

@@ -5,7 +5,7 @@
'use strict';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as fspath from 'path';
import * as fs from 'fs';
@@ -153,10 +153,10 @@ export class FolderNode extends HdfsFileSourceNode {
return item;
}
getNodeInfo(): sqlops.NodeInfo {
getNodeInfo(): azdata.NodeInfo {
// TODO handle error message case by returning it in the OE API
// TODO support better mapping of node type
let nodeInfo: sqlops.NodeInfo = {
let nodeInfo: azdata.NodeInfo = {
label: this.getDisplayName(),
isLeaf: false,
errorMessage: undefined,
@@ -252,9 +252,9 @@ export class FileNode extends HdfsFileSourceNode implements IFileNode {
}
getNodeInfo(): sqlops.NodeInfo {
getNodeInfo(): azdata.NodeInfo {
// TODO improve node type handling so it's not tied to SQL Server types
let nodeInfo: sqlops.NodeInfo = {
let nodeInfo: azdata.NodeInfo = {
label: this.getDisplayName(),
isLeaf: true,
errorMessage: undefined,
@@ -349,8 +349,8 @@ export class ErrorNode extends TreeNode {
}
getNodeInfo(): sqlops.NodeInfo {
let nodeInfo: sqlops.NodeInfo = {
getNodeInfo(): azdata.NodeInfo {
let nodeInfo: azdata.NodeInfo = {
label: this.message,
isLeaf: false,
errorMessage: undefined,

View File

@@ -5,7 +5,7 @@
'use strict';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
@@ -23,10 +23,10 @@ import { ICommandObjectExplorerContext } from './command';
export const mssqlOutputChannel = vscode.window.createOutputChannel(constants.providerId);
export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sqlops.ObjectExplorerNodeProvider, ITreeChangeHandler {
export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azdata.ObjectExplorerNodeProvider, ITreeChangeHandler {
public readonly supportedProviderId: string = constants.providerId;
private sessionMap: Map<string, SqlClusterSession>;
private expandCompleteEmitter = new vscode.EventEmitter<sqlops.ObjectExplorerExpandInfo>();
private expandCompleteEmitter = new vscode.EventEmitter<azdata.ObjectExplorerExpandInfo>();
constructor(private appContext: AppContext) {
super();
@@ -34,7 +34,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sql
this.appContext.registerService<MssqlObjectExplorerNodeProvider>(constants.ObjectExplorerService, this);
}
handleSessionOpen(session: sqlops.ObjectExplorerSession): Thenable<boolean> {
handleSessionOpen(session: azdata.ObjectExplorerSession): Thenable<boolean> {
return new Promise((resolve, reject) => {
if (!session) {
reject('handleSessionOpen requires a session object to be passed');
@@ -44,10 +44,10 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sql
});
}
private async doSessionOpen(session: sqlops.ObjectExplorerSession): Promise<boolean> {
private async doSessionOpen(session: azdata.ObjectExplorerSession): Promise<boolean> {
if (!session || !session.sessionId) { return false; }
let sqlConnProfile = await sqlops.objectexplorer.getSessionConnectionProfile(session.sessionId);
let sqlConnProfile = await azdata.objectexplorer.getSessionConnectionProfile(session.sessionId);
if (!sqlConnProfile) { return false; }
let clusterConnInfo = await SqlClusterLookUp.getSqlClusterConnection(sqlConnProfile);
@@ -59,7 +59,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sql
return true;
}
expandNode(nodeInfo: sqlops.ExpandNodeInfo, isRefresh: boolean = false): Thenable<boolean> {
expandNode(nodeInfo: azdata.ExpandNodeInfo, isRefresh: boolean = false): Thenable<boolean> {
return new Promise((resolve, reject) => {
if (!nodeInfo) {
reject('expandNode requires a nodeInfo object to be passed');
@@ -69,7 +69,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sql
});
}
private async doExpandNode(nodeInfo: sqlops.ExpandNodeInfo, isRefresh: boolean = false): Promise<boolean> {
private async doExpandNode(nodeInfo: azdata.ExpandNodeInfo, isRefresh: boolean = false): Promise<boolean> {
let session = this.sessionMap.get(nodeInfo.sessionId);
let response = {
sessionId: nodeInfo.sessionId,
@@ -95,8 +95,8 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sql
return true;
}
private async startExpansion(session: SqlClusterSession, nodeInfo: sqlops.ExpandNodeInfo, isRefresh: boolean = false): Promise<void> {
let expandResult: sqlops.ObjectExplorerExpandInfo = {
private async startExpansion(session: SqlClusterSession, nodeInfo: azdata.ExpandNodeInfo, isRefresh: boolean = false): Promise<void> {
let expandResult: azdata.ObjectExplorerExpandInfo = {
sessionId: session.sessionId,
nodePath: nodeInfo.nodePath,
errorMessage: undefined,
@@ -125,24 +125,24 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sql
this.expandCompleteEmitter.fire(expandResult);
}
refreshNode(nodeInfo: sqlops.ExpandNodeInfo): Thenable<boolean> {
refreshNode(nodeInfo: azdata.ExpandNodeInfo): Thenable<boolean> {
// TODO #3815 implement properly
return this.expandNode(nodeInfo, true);
}
handleSessionClose(closeSessionInfo: sqlops.ObjectExplorerCloseSessionInfo): void {
handleSessionClose(closeSessionInfo: azdata.ObjectExplorerCloseSessionInfo): void {
this.sessionMap.delete(closeSessionInfo.sessionId);
}
findNodes(findNodesInfo: sqlops.FindNodesInfo): Thenable<sqlops.ObjectExplorerFindNodesResponse> {
findNodes(findNodesInfo: azdata.FindNodesInfo): Thenable<azdata.ObjectExplorerFindNodesResponse> {
// TODO #3814 implement
let response: sqlops.ObjectExplorerFindNodesResponse = {
let response: azdata.ObjectExplorerFindNodesResponse = {
nodes: []
};
return Promise.resolve(response);
}
registerOnExpandCompleted(handler: (response: sqlops.ObjectExplorerExpandInfo) => any): void {
registerOnExpandCompleted(handler: (response: azdata.ObjectExplorerExpandInfo) => any): void {
this.expandCompleteEmitter.event(handler);
}
@@ -157,7 +157,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sql
this.appContext.apiWrapper.showErrorMessage(localize('sessionNotFound', 'Session for node {0} does not exist', node.nodePathValue));
} else {
let nodeInfo = node.getNodeInfo();
let expandInfo: sqlops.ExpandNodeInfo = {
let expandInfo: azdata.ExpandNodeInfo = {
nodePath: nodeInfo.nodePath,
sessionId: session.sessionId
};
@@ -181,7 +181,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sql
return sqlClusterSession;
}
async findSqlClusterNodeByContext<T extends TreeNode>(context: ICommandObjectExplorerContext | sqlops.ObjectExplorerContext): Promise<T> {
async findSqlClusterNodeByContext<T extends TreeNode>(context: ICommandObjectExplorerContext | azdata.ObjectExplorerContext): Promise<T> {
let node: T = undefined;
let explorerContext = 'explorerContext' in context ? context.explorerContext : context;
let sqlConnProfile = explorerContext.connectionProfile;
@@ -198,7 +198,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements sql
return node;
}
public findSqlClusterSessionBySqlConnProfile(connectionProfile: sqlops.IConnectionProfile): SqlClusterSession {
public findSqlClusterSessionBySqlConnProfile(connectionProfile: azdata.IConnectionProfile): SqlClusterSession {
for (let session of this.sessionMap.values()) {
if (session.isMatchedSqlConnection(connectionProfile)) {
return session;
@@ -213,8 +213,8 @@ export class SqlClusterSession {
constructor(
private _sqlClusterConnection: SqlClusterConnection,
private _sqlSession: sqlops.ObjectExplorerSession,
private _sqlConnectionProfile: sqlops.IConnectionProfile,
private _sqlSession: azdata.ObjectExplorerSession,
private _sqlConnectionProfile: azdata.IConnectionProfile,
private _appContext: AppContext,
private _changeHandler: ITreeChangeHandler
) {
@@ -224,12 +224,12 @@ export class SqlClusterSession {
}
public get sqlClusterConnection(): SqlClusterConnection { return this._sqlClusterConnection; }
public get sqlSession(): sqlops.ObjectExplorerSession { return this._sqlSession; }
public get sqlConnectionProfile(): sqlops.IConnectionProfile { return this._sqlConnectionProfile; }
public get sqlSession(): azdata.ObjectExplorerSession { return this._sqlSession; }
public get sqlConnectionProfile(): azdata.IConnectionProfile { return this._sqlConnectionProfile; }
public get sessionId(): string { return this._sqlSession.sessionId; }
public get rootNode(): SqlClusterRootNode { return this._rootNode; }
public isMatchedSqlConnection(sqlConnProfile: sqlops.IConnectionProfile): boolean {
public isMatchedSqlConnection(sqlConnProfile: azdata.IConnectionProfile): boolean {
return this._sqlConnectionProfile.id === sqlConnProfile.id;
}
}
@@ -266,8 +266,8 @@ class SqlClusterRootNode extends TreeNode {
throw new Error('Not intended for use in a file explorer view.');
}
getNodeInfo(): sqlops.NodeInfo {
let nodeInfo: sqlops.NodeInfo = {
getNodeInfo(): azdata.NodeInfo {
let nodeInfo: azdata.NodeInfo = {
label: localize('rootLabel', 'Root'),
isLeaf: false,
errorMessage: undefined,
@@ -311,8 +311,8 @@ class DataServicesNode extends TreeNode {
throw new Error('Not intended for use in a file explorer view.');
}
getNodeInfo(): sqlops.NodeInfo {
let nodeInfo: sqlops.NodeInfo = {
getNodeInfo(): azdata.NodeInfo {
let nodeInfo: azdata.NodeInfo = {
label: localize('dataServicesLabel', 'Data Services'),
isLeaf: false,
errorMessage: undefined,

View File

@@ -5,7 +5,7 @@
'use strict';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import { ITreeNode } from './types';
@@ -74,5 +74,5 @@ export abstract class TreeNode implements ITreeNode {
abstract getChildren(refreshChildren: boolean): TreeNode[] | Promise<TreeNode[]>;
abstract getTreeItem(): vscode.TreeItem | Promise<vscode.TreeItem>;
abstract getNodeInfo(): sqlops.NodeInfo;
abstract getNodeInfo(): azdata.NodeInfo;
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
/**
* A tree node in the object explorer tree
@@ -13,7 +13,7 @@ import * as sqlops from 'sqlops';
* @interface ITreeNode
*/
export interface ITreeNode {
getNodeInfo(): sqlops.NodeInfo;
getNodeInfo(): azdata.NodeInfo;
getChildren(refreshChildren: boolean): ITreeNode[] | Promise<ITreeNode[]>;
}