Object explorer notifications (#354)

* changing oe protocols to send notifications
This commit is contained in:
Leila Lali
2017-05-23 09:30:11 -07:00
committed by GitHub
parent 6920e6bfd3
commit 63372d327e
10 changed files with 482 additions and 293 deletions

View File

@@ -1,45 +1,76 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts
{
/// <summary>
/// Information returned from a <see cref="CreateSessionRequest"/>.
/// Contains success information, a <see cref="SessionId"/> to be used when
/// requesting expansion of nodes, and a root node to display for this area.
/// </summary>
public class CreateSessionResponse
{
/// <summary>
/// Boolean indicating if the connection was successful
/// </summary>
public bool Success { get; set; }
/// <summary>
/// Unique ID to use when sending any requests for objects in the
/// tree under the node
/// </summary>
public string SessionId { get; set; }
/// <summary>
/// Information describing the base node in the tree
/// </summary>
public NodeInfo RootNode { get; set; }
}
/// <summary>
/// Establishes an Object Explorer tree session for a specific connection.
/// This will create a connection to a specific server or database, register
/// it for use in the
/// </summary>
public class CreateSessionRequest
{
public static readonly
RequestType<ConnectionDetails, CreateSessionResponse> Type =
RequestType<ConnectionDetails, CreateSessionResponse>.Create("objectexplorer/createsession");
}
}
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts
{
/// <summary>
/// Information returned from a <see cref="CreateSessionRequest"/>.
/// Contains success information, a <see cref="SessionId"/> to be used when
/// requesting expansion of nodes, and a root node to display for this area.
/// </summary>
public class CreateSessionResponse
{
/// <summary>
/// Unique ID to use when sending any requests for objects in the
/// tree under the node
/// </summary>
public string SessionId { get; set; }
}
/// <summary>
/// Information returned from a <see cref="CreateSessionRequest"/>.
/// Contains success information, a <see cref="SessionId"/> to be used when
/// requesting expansion of nodes, and a root node to display for this area.
/// </summary>
public class SessionCreatedParameters
{
/// <summary>
/// Boolean indicating if the connection was successful
/// </summary>
public bool Success { get; set; }
/// <summary>
/// Unique ID to use when sending any requests for objects in the
/// tree under the node
/// </summary>
public string SessionId { get; set; }
/// <summary>
/// Information describing the base node in the tree
/// </summary>
public NodeInfo RootNode { get; set; }
/// <summary>
/// Error message returned from the engine for a object explorer session failure reason, if any.
/// </summary>
public string ErrorMessage { get; set; }
}
/// <summary>
/// Establishes an Object Explorer tree session for a specific connection.
/// This will create a connection to a specific server or database, register
/// it for use in the
/// </summary>
public class CreateSessionRequest
{
public static readonly
RequestType<ConnectionDetails, CreateSessionResponse> Type =
RequestType<ConnectionDetails, CreateSessionResponse>.Create("objectexplorer/createsession");
}
/// <summary>
/// Session notification mapping entry
/// </summary>
public class CreateSessionCompleteNotification
{
public static readonly
EventType<SessionCreatedParameters> Type =
EventType<SessionCreatedParameters>.Create("objectexplorer/sessionCreated");
}
}

View File

@@ -1,56 +1,76 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts
{
/// <summary>
/// Information returned from a <see cref="ExpandRequest"/>.
/// </summary>
/// <summary>
/// Information returned from a <see cref="ExpandRequest"/>.
/// </summary>
public class ExpandResponse
{
/// <summary>
/// Unique ID to use when sending any requests for objects in the
/// tree under the node
/// </summary>
/// <summary>
/// Unique ID to use when sending any requests for objects in the
/// tree under the node
/// </summary>
public string SessionId { get; set; }
/// <summary>
/// Information describing the expanded nodes in the tree
/// </summary>
/// <summary>
/// Information describing the expanded nodes in the tree
/// </summary>
public NodeInfo[] Nodes { get; set; }
}
/// <summary>
/// Parameters to the <see cref="ExpandRequest"/>.
/// </summary>
public class ExpandParams
{
/// <summary>
/// The Id returned from a <see cref="CreateSessionRequest"/>. This
/// is used to disambiguate between different trees.
/// </summary>
public string SessionId { get; set; }
/// <summary>
/// Path identifying the node to expand. See <see cref="NodeInfo.NodePath"/> for details
/// </summary>
public string NodePath { get; set; }
}
/// <summary>
/// A request to expand a
/// </summary>
public class ExpandRequest
{
/// <summary>
/// Returns children of a given node as a <see cref="NodeInfo"/> array.
/// </summary>
public static readonly
RequestType<ExpandParams, ExpandResponse> Type =
RequestType<ExpandParams, ExpandResponse>.Create("objectexplorer/expand");
}
}
/// <summary>
/// Path identifying the node to expand. See <see cref="NodeInfo.NodePath"/> for details
/// </summary>
public string NodePath { get; set; }
/// <summary>
/// Error message returned from the engine for a object explorer expand failure reason, if any.
/// </summary>
public string ErrorMessage { get; set; }
}
/// <summary>
/// Parameters to the <see cref="ExpandRequest"/>.
/// </summary>
public class ExpandParams
{
/// <summary>
/// The Id returned from a <see cref="CreateSessionRequest"/>. This
/// is used to disambiguate between different trees.
/// </summary>
public string SessionId { get; set; }
/// <summary>
/// Path identifying the node to expand. See <see cref="NodeInfo.NodePath"/> for details
/// </summary>
public string NodePath { get; set; }
}
/// <summary>
/// A request to expand a
/// </summary>
public class ExpandRequest
{
/// <summary>
/// Returns children of a given node as a <see cref="NodeInfo"/> array.
/// </summary>
public static readonly
RequestType<ExpandParams, bool> Type =
RequestType<ExpandParams, bool>.Create("objectexplorer/expand");
}
/// <summary>
/// Expand notification mapping entry
/// </summary>
public class ExpandCompleteNotification
{
public static readonly
EventType<ExpandResponse> Type =
EventType<ExpandResponse>.Create("objectexplorer/expandCompleted");
}
}

View File

@@ -53,5 +53,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts
/// Object Metadata for smo objects to be used for scripting
/// </summary>
public ObjectMetadata Metadata { get; set; }
/// <summary>
/// Error message returned from the engine for a object explorer node failure reason, if any.
/// </summary>
public string ErrorMessage { get; set; }
}
}

View File

@@ -7,38 +7,11 @@ using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts
{
/// <summary>
/// Information returned from a <see cref="RefreshRequest"/>.
/// </summary>
public class RefreshResponse
{
/// <summary>
/// Unique ID to use when sending any requests for objects in the
/// tree under the node
/// </summary>
public string SessionId { get; set; }
/// <summary>
/// Information describing the expanded nodes in the tree
/// </summary>
public NodeInfo[] Nodes { get; set; }
}
/// <summary>
/// Parameters to the <see cref="ExpandRequest"/>.
/// </summary>
public class RefreshParams
public class RefreshParams: ExpandParams
{
/// <summary>
/// The Id returned from a <see cref="CreateSessionRequest"/>. This
/// is used to disambiguate between different trees.
/// </summary>
public string SessionId { get; set; }
/// <summary>
/// Path identifying the node to refresh. See <see cref="NodeInfo.NodePath"/> for details
/// </summary>
public string NodePath { get; set; }
}
/// <summary>
@@ -50,7 +23,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts
/// Returns children of a given node as a <see cref="NodeInfo"/> array.
/// </summary>
public static readonly
RequestType<RefreshParams, RefreshResponse> Type =
RequestType<RefreshParams, RefreshResponse>.Create("objectexplorer/refresh");
RequestType<RefreshParams, bool> Type =
RequestType<RefreshParams, bool>.Create("objectexplorer/refresh");
}
}