diff --git a/desktop/src/Plexus.Host/Internal/Generated/interop/AppConnectionDescriptor.msg.g.cs b/desktop/src/Plexus.Host/Internal/Generated/interop/AppConnectionDescriptor.msg.g.cs new file mode 100644 index 000000000..259502f84 --- /dev/null +++ b/desktop/src/Plexus.Host/Internal/Generated/interop/AppConnectionDescriptor.msg.g.cs @@ -0,0 +1,261 @@ +/** + * Copyright 2017-2018 Plexus Interop Deutsche Bank AG + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: interop/app_connection_descriptor.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Plexus.Host.Internal.Generated { + + /// Holder for reflection information generated from interop/app_connection_descriptor.proto + internal static partial class AppConnectionDescriptorReflection { + + #region Descriptor + /// File descriptor for interop/app_connection_descriptor.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static AppConnectionDescriptorReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CidpbnRlcm9wL2FwcF9jb25uZWN0aW9uX2Rlc2NyaXB0b3IucHJvdG8SB2lu", + "dGVyb3AaF2ludGVyb3AvdW5pcXVlX2lkLnByb3RvGhVpbnRlcm9wL29wdGlv", + "bnMucHJvdG8ipAEKF0FwcENvbm5lY3Rpb25EZXNjcmlwdG9yEigKDWNvbm5l", + "Y3Rpb25faWQYASABKAsyES5pbnRlcm9wLlVuaXF1ZUlkEg4KBmFwcF9pZBgC", + "IAEoCRIqCg9hcHBfaW5zdGFuY2VfaWQYAyABKAsyES5pbnRlcm9wLlVuaXF1", + "ZUlkOiOS2wQfaW50ZXJvcC5BcHBDb25uZWN0aW9uRGVzY3JpcHRvckIhqgIe", + "UGxleHVzLkhvc3QuSW50ZXJuYWwuR2VuZXJhdGVkYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Plexus.Host.Internal.Generated.UniqueIdReflection.Descriptor, global::Plexus.Host.Internal.Generated.OptionsReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Host.Internal.Generated.AppConnectionDescriptor), global::Plexus.Host.Internal.Generated.AppConnectionDescriptor.Parser, new[]{ "ConnectionId", "AppId", "AppInstanceId" }, null, null, null) + })); + } + #endregion + + } + #region Messages + internal sealed partial class AppConnectionDescriptor : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AppConnectionDescriptor()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Plexus.Host.Internal.Generated.AppConnectionDescriptorReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppConnectionDescriptor() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppConnectionDescriptor(AppConnectionDescriptor other) : this() { + ConnectionId = other.connectionId_ != null ? other.ConnectionId.Clone() : null; + appId_ = other.appId_; + AppInstanceId = other.appInstanceId_ != null ? other.AppInstanceId.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppConnectionDescriptor Clone() { + return new AppConnectionDescriptor(this); + } + + /// Field number for the "connection_id" field. + public const int ConnectionIdFieldNumber = 1; + private global::Plexus.Host.Internal.Generated.UniqueId connectionId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Plexus.Host.Internal.Generated.UniqueId ConnectionId { + get { return connectionId_; } + set { + connectionId_ = value; + } + } + + /// Field number for the "app_id" field. + public const int AppIdFieldNumber = 2; + private string appId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string AppId { + get { return appId_; } + set { + appId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "app_instance_id" field. + public const int AppInstanceIdFieldNumber = 3; + private global::Plexus.Host.Internal.Generated.UniqueId appInstanceId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Plexus.Host.Internal.Generated.UniqueId AppInstanceId { + get { return appInstanceId_; } + set { + appInstanceId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AppConnectionDescriptor); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AppConnectionDescriptor other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(ConnectionId, other.ConnectionId)) return false; + if (AppId != other.AppId) return false; + if (!object.Equals(AppInstanceId, other.AppInstanceId)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (connectionId_ != null) hash ^= ConnectionId.GetHashCode(); + if (AppId.Length != 0) hash ^= AppId.GetHashCode(); + if (appInstanceId_ != null) hash ^= AppInstanceId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (connectionId_ != null) { + output.WriteRawTag(10); + output.WriteMessage(ConnectionId); + } + if (AppId.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AppId); + } + if (appInstanceId_ != null) { + output.WriteRawTag(26); + output.WriteMessage(AppInstanceId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (connectionId_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ConnectionId); + } + if (AppId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(AppId); + } + if (appInstanceId_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(AppInstanceId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AppConnectionDescriptor other) { + if (other == null) { + return; + } + if (other.connectionId_ != null) { + if (connectionId_ == null) { + connectionId_ = new global::Plexus.Host.Internal.Generated.UniqueId(); + } + ConnectionId.MergeFrom(other.ConnectionId); + } + if (other.AppId.Length != 0) { + AppId = other.AppId; + } + if (other.appInstanceId_ != null) { + if (appInstanceId_ == null) { + appInstanceId_ = new global::Plexus.Host.Internal.Generated.UniqueId(); + } + AppInstanceId.MergeFrom(other.AppInstanceId); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (connectionId_ == null) { + connectionId_ = new global::Plexus.Host.Internal.Generated.UniqueId(); + } + input.ReadMessage(connectionId_); + break; + } + case 18: { + AppId = input.ReadString(); + break; + } + case 26: { + if (appInstanceId_ == null) { + appInstanceId_ = new global::Plexus.Host.Internal.Generated.UniqueId(); + } + input.ReadMessage(appInstanceId_); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/desktop/src/Plexus.Host/Internal/Generated/interop/AppLifecycleService.msg.g.cs b/desktop/src/Plexus.Host/Internal/Generated/interop/AppLifecycleService.msg.g.cs index 2ca95d649..2dab188cf 100644 --- a/desktop/src/Plexus.Host/Internal/Generated/interop/AppLifecycleService.msg.g.cs +++ b/desktop/src/Plexus.Host/Internal/Generated/interop/AppLifecycleService.msg.g.cs @@ -42,23 +42,38 @@ static AppLifecycleServiceReflection() { string.Concat( "CiNpbnRlcm9wL2FwcF9saWZlY3ljbGVfc2VydmljZS5wcm90bxIHaW50ZXJv", "cBoXaW50ZXJvcC91bmlxdWVfaWQucHJvdG8aHWludGVyb3AvYXBwX2xhdW5j", - "aF9tb2RlLnByb3RvGhVpbnRlcm9wL29wdGlvbnMucHJvdG8idAoRUmVzb2x2", - "ZUFwcFJlcXVlc3QSDgoGYXBwX2lkGAEgASgJEjAKEGFwcF9yZXNvbHZlX21v", - "ZGUYAiABKA4yFi5pbnRlcm9wLkFwcExhdW5jaE1vZGU6HZLbBBlpbnRlcm9w", - "LlJlc29sdmVBcHBSZXF1ZXN0IrABChJSZXNvbHZlQXBwUmVzcG9uc2USKgoP", - "YXBwX2luc3RhbmNlX2lkGAEgASgLMhEuaW50ZXJvcC5VbmlxdWVJZBIsChFh", - "cHBfY29ubmVjdGlvbl9pZBgCIAEoCzIRLmludGVyb3AuVW5pcXVlSWQSIAoY", - "aXNfbmV3X2luc3RhbmNlX2xhdW5jaGVkGAMgASgIOh6S2wQaaW50ZXJvcC5S", - "ZXNvbHZlQXBwUmVzcG9uc2UyfQoTQXBwTGlmZWN5Y2xlU2VydmljZRJFCgpS", - "ZXNvbHZlQXBwEhouaW50ZXJvcC5SZXNvbHZlQXBwUmVxdWVzdBobLmludGVy", - "b3AuUmVzb2x2ZUFwcFJlc3BvbnNlGh+S2wQbaW50ZXJvcC5BcHBMaWZlY3lj", - "bGVTZXJ2aWNlQiGqAh5QbGV4dXMuSG9zdC5JbnRlcm5hbC5HZW5lcmF0ZWRi", - "BnByb3RvMw==")); + "aF9tb2RlLnByb3RvGidpbnRlcm9wL2FwcF9jb25uZWN0aW9uX2Rlc2NyaXB0", + "b3IucHJvdG8aG2dvb2dsZS9wcm90b2J1Zi9lbXB0eS5wcm90bxoVaW50ZXJv", + "cC9vcHRpb25zLnByb3RvInQKEVJlc29sdmVBcHBSZXF1ZXN0Eg4KBmFwcF9p", + "ZBgBIAEoCRIwChBhcHBfcmVzb2x2ZV9tb2RlGAIgASgOMhYuaW50ZXJvcC5B", + "cHBMYXVuY2hNb2RlOh2S2wQZaW50ZXJvcC5SZXNvbHZlQXBwUmVxdWVzdCKw", + "AQoSUmVzb2x2ZUFwcFJlc3BvbnNlEioKD2FwcF9pbnN0YW5jZV9pZBgBIAEo", + "CzIRLmludGVyb3AuVW5pcXVlSWQSLAoRYXBwX2Nvbm5lY3Rpb25faWQYAiAB", + "KAsyES5pbnRlcm9wLlVuaXF1ZUlkEiAKGGlzX25ld19pbnN0YW5jZV9sYXVu", + "Y2hlZBgDIAEoCDoektsEGmludGVyb3AuUmVzb2x2ZUFwcFJlc3BvbnNlIqMB", + "ChFBcHBMaWZlY3ljbGVFdmVudBIvCgljb25uZWN0ZWQYASABKAsyGi5pbnRl", + "cm9wLkFwcENvbm5lY3RlZEV2ZW50SAASNQoMZGlzY29ubmVjdGVkGAIgASgL", + "Mh0uaW50ZXJvcC5BcHBEaXNjb25uZWN0ZWRFdmVudEgAOh2S2wQZaW50ZXJv", + "cC5BcHBMaWZlY3ljbGVFdmVudEIHCgVldmVudCJzChFBcHBDb25uZWN0ZWRF", + "dmVudBI/ChVjb25uZWN0aW9uX2Rlc2NyaXB0b3IYASABKAsyIC5pbnRlcm9w", + "LkFwcENvbm5lY3Rpb25EZXNjcmlwdG9yOh2S2wQZaW50ZXJvcC5BcHBDb25u", + "ZWN0ZWRFdmVudCJ5ChRBcHBEaXNjb25uZWN0ZWRFdmVudBI/ChVjb25uZWN0", + "aW9uX2Rlc2NyaXB0b3IYASABKAsyIC5pbnRlcm9wLkFwcENvbm5lY3Rpb25E", + "ZXNjcmlwdG9yOiCS2wQcaW50ZXJvcC5BcHBEaXNjb25uZWN0ZWRFdmVudDLO", + "AQoTQXBwTGlmZWN5Y2xlU2VydmljZRJFCgpSZXNvbHZlQXBwEhouaW50ZXJv", + "cC5SZXNvbHZlQXBwUmVxdWVzdBobLmludGVyb3AuUmVzb2x2ZUFwcFJlc3Bv", + "bnNlEk8KF0dldExpZmVjeWNsZUV2ZW50U3RyZWFtEhYuZ29vZ2xlLnByb3Rv", + "YnVmLkVtcHR5GhouaW50ZXJvcC5BcHBMaWZlY3ljbGVFdmVudDABGh+S2wQb", + "aW50ZXJvcC5BcHBMaWZlY3ljbGVTZXJ2aWNlQiGqAh5QbGV4dXMuSG9zdC5J", + "bnRlcm5hbC5HZW5lcmF0ZWRiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Plexus.Host.Internal.Generated.UniqueIdReflection.Descriptor, global::Plexus.Host.Internal.Generated.AppLaunchModeReflection.Descriptor, global::Plexus.Host.Internal.Generated.OptionsReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Plexus.Host.Internal.Generated.UniqueIdReflection.Descriptor, global::Plexus.Host.Internal.Generated.AppLaunchModeReflection.Descriptor, global::Plexus.Host.Internal.Generated.AppConnectionDescriptorReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Plexus.Host.Internal.Generated.OptionsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Host.Internal.Generated.ResolveAppRequest), global::Plexus.Host.Internal.Generated.ResolveAppRequest.Parser, new[]{ "AppId", "AppResolveMode" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Host.Internal.Generated.ResolveAppResponse), global::Plexus.Host.Internal.Generated.ResolveAppResponse.Parser, new[]{ "AppInstanceId", "AppConnectionId", "IsNewInstanceLaunched" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Host.Internal.Generated.ResolveAppResponse), global::Plexus.Host.Internal.Generated.ResolveAppResponse.Parser, new[]{ "AppInstanceId", "AppConnectionId", "IsNewInstanceLaunched" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Host.Internal.Generated.AppLifecycleEvent), global::Plexus.Host.Internal.Generated.AppLifecycleEvent.Parser, new[]{ "Connected", "Disconnected" }, new[]{ "Event" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Host.Internal.Generated.AppConnectedEvent), global::Plexus.Host.Internal.Generated.AppConnectedEvent.Parser, new[]{ "ConnectionDescriptor" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Host.Internal.Generated.AppDisconnectedEvent), global::Plexus.Host.Internal.Generated.AppDisconnectedEvent.Parser, new[]{ "ConnectionDescriptor" }, null, null, null) })); } #endregion @@ -419,6 +434,480 @@ public void MergeFrom(pb::CodedInputStream input) { } + internal sealed partial class AppLifecycleEvent : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AppLifecycleEvent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Plexus.Host.Internal.Generated.AppLifecycleServiceReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppLifecycleEvent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppLifecycleEvent(AppLifecycleEvent other) : this() { + switch (other.EventCase) { + case EventOneofCase.Connected: + Connected = other.Connected.Clone(); + break; + case EventOneofCase.Disconnected: + Disconnected = other.Disconnected.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppLifecycleEvent Clone() { + return new AppLifecycleEvent(this); + } + + /// Field number for the "connected" field. + public const int ConnectedFieldNumber = 1; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Plexus.Host.Internal.Generated.AppConnectedEvent Connected { + get { return eventCase_ == EventOneofCase.Connected ? (global::Plexus.Host.Internal.Generated.AppConnectedEvent) event_ : null; } + set { + event_ = value; + eventCase_ = value == null ? EventOneofCase.None : EventOneofCase.Connected; + } + } + + /// Field number for the "disconnected" field. + public const int DisconnectedFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Plexus.Host.Internal.Generated.AppDisconnectedEvent Disconnected { + get { return eventCase_ == EventOneofCase.Disconnected ? (global::Plexus.Host.Internal.Generated.AppDisconnectedEvent) event_ : null; } + set { + event_ = value; + eventCase_ = value == null ? EventOneofCase.None : EventOneofCase.Disconnected; + } + } + + private object event_; + /// Enum of possible cases for the "event" oneof. + public enum EventOneofCase { + None = 0, + Connected = 1, + Disconnected = 2, + } + private EventOneofCase eventCase_ = EventOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EventOneofCase EventCase { + get { return eventCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearEvent() { + eventCase_ = EventOneofCase.None; + event_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AppLifecycleEvent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AppLifecycleEvent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Connected, other.Connected)) return false; + if (!object.Equals(Disconnected, other.Disconnected)) return false; + if (EventCase != other.EventCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (eventCase_ == EventOneofCase.Connected) hash ^= Connected.GetHashCode(); + if (eventCase_ == EventOneofCase.Disconnected) hash ^= Disconnected.GetHashCode(); + hash ^= (int) eventCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (eventCase_ == EventOneofCase.Connected) { + output.WriteRawTag(10); + output.WriteMessage(Connected); + } + if (eventCase_ == EventOneofCase.Disconnected) { + output.WriteRawTag(18); + output.WriteMessage(Disconnected); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (eventCase_ == EventOneofCase.Connected) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Connected); + } + if (eventCase_ == EventOneofCase.Disconnected) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Disconnected); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AppLifecycleEvent other) { + if (other == null) { + return; + } + switch (other.EventCase) { + case EventOneofCase.Connected: + if (Connected == null) { + Connected = new global::Plexus.Host.Internal.Generated.AppConnectedEvent(); + } + Connected.MergeFrom(other.Connected); + break; + case EventOneofCase.Disconnected: + if (Disconnected == null) { + Disconnected = new global::Plexus.Host.Internal.Generated.AppDisconnectedEvent(); + } + Disconnected.MergeFrom(other.Disconnected); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + global::Plexus.Host.Internal.Generated.AppConnectedEvent subBuilder = new global::Plexus.Host.Internal.Generated.AppConnectedEvent(); + if (eventCase_ == EventOneofCase.Connected) { + subBuilder.MergeFrom(Connected); + } + input.ReadMessage(subBuilder); + Connected = subBuilder; + break; + } + case 18: { + global::Plexus.Host.Internal.Generated.AppDisconnectedEvent subBuilder = new global::Plexus.Host.Internal.Generated.AppDisconnectedEvent(); + if (eventCase_ == EventOneofCase.Disconnected) { + subBuilder.MergeFrom(Disconnected); + } + input.ReadMessage(subBuilder); + Disconnected = subBuilder; + break; + } + } + } + } + + } + + internal sealed partial class AppConnectedEvent : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AppConnectedEvent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Plexus.Host.Internal.Generated.AppLifecycleServiceReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppConnectedEvent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppConnectedEvent(AppConnectedEvent other) : this() { + ConnectionDescriptor = other.connectionDescriptor_ != null ? other.ConnectionDescriptor.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppConnectedEvent Clone() { + return new AppConnectedEvent(this); + } + + /// Field number for the "connection_descriptor" field. + public const int ConnectionDescriptorFieldNumber = 1; + private global::Plexus.Host.Internal.Generated.AppConnectionDescriptor connectionDescriptor_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Plexus.Host.Internal.Generated.AppConnectionDescriptor ConnectionDescriptor { + get { return connectionDescriptor_; } + set { + connectionDescriptor_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AppConnectedEvent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AppConnectedEvent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(ConnectionDescriptor, other.ConnectionDescriptor)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (connectionDescriptor_ != null) hash ^= ConnectionDescriptor.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (connectionDescriptor_ != null) { + output.WriteRawTag(10); + output.WriteMessage(ConnectionDescriptor); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (connectionDescriptor_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ConnectionDescriptor); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AppConnectedEvent other) { + if (other == null) { + return; + } + if (other.connectionDescriptor_ != null) { + if (connectionDescriptor_ == null) { + connectionDescriptor_ = new global::Plexus.Host.Internal.Generated.AppConnectionDescriptor(); + } + ConnectionDescriptor.MergeFrom(other.ConnectionDescriptor); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (connectionDescriptor_ == null) { + connectionDescriptor_ = new global::Plexus.Host.Internal.Generated.AppConnectionDescriptor(); + } + input.ReadMessage(connectionDescriptor_); + break; + } + } + } + } + + } + + internal sealed partial class AppDisconnectedEvent : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AppDisconnectedEvent()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Plexus.Host.Internal.Generated.AppLifecycleServiceReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppDisconnectedEvent() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppDisconnectedEvent(AppDisconnectedEvent other) : this() { + ConnectionDescriptor = other.connectionDescriptor_ != null ? other.ConnectionDescriptor.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AppDisconnectedEvent Clone() { + return new AppDisconnectedEvent(this); + } + + /// Field number for the "connection_descriptor" field. + public const int ConnectionDescriptorFieldNumber = 1; + private global::Plexus.Host.Internal.Generated.AppConnectionDescriptor connectionDescriptor_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Plexus.Host.Internal.Generated.AppConnectionDescriptor ConnectionDescriptor { + get { return connectionDescriptor_; } + set { + connectionDescriptor_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AppDisconnectedEvent); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AppDisconnectedEvent other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(ConnectionDescriptor, other.ConnectionDescriptor)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (connectionDescriptor_ != null) hash ^= ConnectionDescriptor.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (connectionDescriptor_ != null) { + output.WriteRawTag(10); + output.WriteMessage(ConnectionDescriptor); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (connectionDescriptor_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ConnectionDescriptor); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AppDisconnectedEvent other) { + if (other == null) { + return; + } + if (other.connectionDescriptor_ != null) { + if (connectionDescriptor_ == null) { + connectionDescriptor_ = new global::Plexus.Host.Internal.Generated.AppConnectionDescriptor(); + } + ConnectionDescriptor.MergeFrom(other.ConnectionDescriptor); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (connectionDescriptor_ == null) { + connectionDescriptor_ = new global::Plexus.Host.Internal.Generated.AppConnectionDescriptor(); + } + input.ReadMessage(connectionDescriptor_); + break; + } + } + } + } + + } + #endregion } diff --git a/desktop/src/Plexus.Host/Internal/Generated/interop/AppLifecycleService.svc.g.cs b/desktop/src/Plexus.Host/Internal/Generated/interop/AppLifecycleService.svc.g.cs index c2cee7651..3f4699773 100644 --- a/desktop/src/Plexus.Host/Internal/Generated/interop/AppLifecycleService.svc.g.cs +++ b/desktop/src/Plexus.Host/Internal/Generated/interop/AppLifecycleService.svc.g.cs @@ -32,6 +32,7 @@ internal static partial class AppLifecycleService { public const string Id = "interop.AppLifecycleService"; public const string ResolveAppMethodId = "ResolveApp"; + public const string GetLifecycleEventStreamMethodId = "GetLifecycleEventStream"; public static readonly AppLifecycleService.Descriptor DefaultDescriptor = CreateDescriptor(); @@ -47,20 +48,31 @@ public partial interface IResolveAppProxy { IUnaryMethodCall ResolveApp(global::Plexus.Host.Internal.Generated.ResolveAppRequest request); } + public partial interface IGetLifecycleEventStreamProxy { + IServerStreamingMethodCall GetLifecycleEventStream(global::Google.Protobuf.WellKnownTypes.Empty request); + } + public partial interface IResolveAppImpl { Task ResolveApp(global::Plexus.Host.Internal.Generated.ResolveAppRequest request, MethodCallContext context); } + public partial interface IGetLifecycleEventStreamImpl { + Task GetLifecycleEventStream(global::Google.Protobuf.WellKnownTypes.Empty request, IWritableChannel responseStream, MethodCallContext context); + } + public sealed partial class Descriptor { public UnaryMethod ResolveAppMethod {get; private set; } + public ServerStreamingMethod GetLifecycleEventStreamMethod {get; private set; } public Descriptor() { ResolveAppMethod = Method.Unary(Id, ResolveAppMethodId); + GetLifecycleEventStreamMethod = Method.ServerStreaming(Id, GetLifecycleEventStreamMethodId); } public Descriptor(string alias) { ResolveAppMethod = Method.Unary(Id, alias, ResolveAppMethodId); + GetLifecycleEventStreamMethod = Method.ServerStreaming(Id, alias, GetLifecycleEventStreamMethodId); } } } diff --git a/desktop/src/Plexus.Interop.Apps.Manager/Internal/AppLifecycleManager.cs b/desktop/src/Plexus.Interop.Apps.Manager/Internal/AppLifecycleManager.cs index f6c9e7e53..b77011cbb 100644 --- a/desktop/src/Plexus.Interop.Apps.Manager/Internal/AppLifecycleManager.cs +++ b/desktop/src/Plexus.Interop.Apps.Manager/Internal/AppLifecycleManager.cs @@ -25,8 +25,7 @@ namespace Plexus.Interop.Apps.Internal using System.IO; using System.Linq; using System.Threading.Tasks; - using AppConnectionDescriptor = Plexus.Interop.Apps.AppConnectionDescriptor; - using UniqueId = Plexus.UniqueId; + using Google.Protobuf.WellKnownTypes; internal sealed class AppLifecycleManager : ProcessBase, IAppLifecycleManager, Generated.AppLifecycleManagerClient.IAppLifecycleServiceImpl { @@ -259,7 +258,7 @@ public IReadOnlyCollection GetOnlineConnections() } Task Generated.AppLifecycleService.IGetLifecycleEventStreamImpl.GetLifecycleEventStream( - Generated.Empty request, IWritableChannel responseStream, MethodCallContext context) + Empty request, IWritableChannel responseStream, MethodCallContext context) { lock (_appLifecycleEventSubscribers) { diff --git a/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/google/protobuf/Empty.msg.g.cs b/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/google/protobuf/Empty.msg.g.cs deleted file mode 100644 index 076ece1a2..000000000 --- a/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/google/protobuf/Empty.msg.g.cs +++ /dev/null @@ -1,175 +0,0 @@ -/** - * Copyright 2017-2018 Plexus Interop Deutsche Bank AG - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/empty.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Plexus.Interop.Apps.Internal.Generated { - - /// Holder for reflection information generated from google/protobuf/empty.proto - internal static partial class EmptyReflection { - - #region Descriptor - /// File descriptor for google/protobuf/empty.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static EmptyReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1", - "ZhoVaW50ZXJvcC9vcHRpb25zLnByb3RvIiIKBUVtcHR5OhmS2wQVZ29vZ2xl", - "LnByb3RvYnVmLkVtcHR5Qn4KE2NvbS5nb29nbGUucHJvdG9idWZCCkVtcHR5", - "UHJvdG9QAVonZ2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2Vt", - "cHR5+AEBogIDR1BCqgImUGxleHVzLkludGVyb3AuQXBwcy5JbnRlcm5hbC5H", - "ZW5lcmF0ZWRiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Plexus.Interop.Apps.Internal.Generated.OptionsReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Interop.Apps.Internal.Generated.Empty), global::Plexus.Interop.Apps.Internal.Generated.Empty.Parser, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// A generic empty message that you can re-use to avoid defining duplicated - /// empty messages in your APIs. A typical example is to use it as the request - /// or the response type of an API method. For instance: - /// - /// service Foo { - /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - /// } - /// - /// The JSON representation for `Empty` is empty JSON object `{}`. - /// - internal sealed partial class Empty : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Empty()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Plexus.Interop.Apps.Internal.Generated.EmptyReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Empty() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Empty(Empty other) : this() { - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Empty Clone() { - return new Empty(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Empty); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Empty other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Empty other) { - if (other == null) { - return; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleManager.app.g.cs b/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleManager.app.g.cs index b4e781e21..9f224f975 100644 --- a/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleManager.app.g.cs +++ b/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleManager.app.g.cs @@ -95,7 +95,7 @@ public ClientOptionsBuilder Bind(ClientOptionsBuilder builder) { private ProvidedServiceDefinition.Builder Bind(ProvidedServiceDefinition.Builder builder) { builder = builder.WithUnaryMethod(global::Plexus.Interop.Apps.Internal.Generated.AppLifecycleService.ResolveAppMethodId, _impl.ResolveApp); - builder = builder.WithServerStreamingMethod(global::Plexus.Interop.Apps.Internal.Generated.AppLifecycleService.GetLifecycleEventStreamMethodId, _impl.GetLifecycleEventStream); + builder = builder.WithServerStreamingMethod(global::Plexus.Interop.Apps.Internal.Generated.AppLifecycleService.GetLifecycleEventStreamMethodId, _impl.GetLifecycleEventStream); return builder; } } @@ -103,11 +103,11 @@ private ProvidedServiceDefinition.Builder Bind(ProvidedServiceDefinition.Builder public sealed partial class AppLifecycleServiceImpl: IAppLifecycleServiceImpl { private readonly UnaryMethodHandler _resolveAppHandler; - private readonly ServerStreamingMethodHandler _getLifecycleEventStreamHandler; + private readonly ServerStreamingMethodHandler _getLifecycleEventStreamHandler; public AppLifecycleServiceImpl( UnaryMethodHandler resolveAppHandler, - ServerStreamingMethodHandler getLifecycleEventStreamHandler + ServerStreamingMethodHandler getLifecycleEventStreamHandler ) { _resolveAppHandler = resolveAppHandler; _getLifecycleEventStreamHandler = getLifecycleEventStreamHandler; @@ -117,7 +117,7 @@ public AppLifecycleServiceImpl( return _resolveAppHandler(request, context); } - public Task GetLifecycleEventStream(global::Plexus.Interop.Apps.Internal.Generated.Empty request, IWritableChannel responseStream, MethodCallContext context) { + public Task GetLifecycleEventStream(global::Google.Protobuf.WellKnownTypes.Empty request, IWritableChannel responseStream, MethodCallContext context) { return _getLifecycleEventStreamHandler(request, responseStream, context); } } @@ -137,7 +137,7 @@ public AppLifecycleServiceImpl(T impl) { return _impl.ResolveApp(request, context); } - public Task GetLifecycleEventStream(global::Plexus.Interop.Apps.Internal.Generated.Empty request, IWritableChannel responseStream, MethodCallContext context) { + public Task GetLifecycleEventStream(global::Google.Protobuf.WellKnownTypes.Empty request, IWritableChannel responseStream, MethodCallContext context) { return _impl.GetLifecycleEventStream(request, responseStream, context); } } diff --git a/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleService.msg.g.cs b/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleService.msg.g.cs index 6263c5b4a..85d0cd3b0 100644 --- a/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleService.msg.g.cs +++ b/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleService.msg.g.cs @@ -67,7 +67,7 @@ static AppLifecycleServiceReflection() { "aW50ZXJvcC5BcHBMaWZlY3ljbGVTZXJ2aWNlQimqAiZQbGV4dXMuSW50ZXJv", "cC5BcHBzLkludGVybmFsLkdlbmVyYXRlZGIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Plexus.Interop.Apps.Internal.Generated.UniqueIdReflection.Descriptor, global::Plexus.Interop.Apps.Internal.Generated.AppLaunchModeReflection.Descriptor, global::Plexus.Interop.Apps.Internal.Generated.AppConnectionDescriptorReflection.Descriptor, global::Plexus.Interop.Apps.Internal.Generated.EmptyReflection.Descriptor, global::Plexus.Interop.Apps.Internal.Generated.OptionsReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Plexus.Interop.Apps.Internal.Generated.UniqueIdReflection.Descriptor, global::Plexus.Interop.Apps.Internal.Generated.AppLaunchModeReflection.Descriptor, global::Plexus.Interop.Apps.Internal.Generated.AppConnectionDescriptorReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Plexus.Interop.Apps.Internal.Generated.OptionsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Interop.Apps.Internal.Generated.ResolveAppRequest), global::Plexus.Interop.Apps.Internal.Generated.ResolveAppRequest.Parser, new[]{ "AppId", "AppResolveMode" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Plexus.Interop.Apps.Internal.Generated.ResolveAppResponse), global::Plexus.Interop.Apps.Internal.Generated.ResolveAppResponse.Parser, new[]{ "AppInstanceId", "AppConnectionId", "IsNewInstanceLaunched" }, null, null, null), diff --git a/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleService.svc.g.cs b/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleService.svc.g.cs index 1a7fd6699..51d38d2ed 100644 --- a/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleService.svc.g.cs +++ b/desktop/src/Plexus.Interop.Apps.Manager/Internal/Generated/interop/AppLifecycleService.svc.g.cs @@ -49,7 +49,7 @@ public partial interface IResolveAppProxy { } public partial interface IGetLifecycleEventStreamProxy { - IServerStreamingMethodCall GetLifecycleEventStream(global::Plexus.Interop.Apps.Internal.Generated.Empty request); + IServerStreamingMethodCall GetLifecycleEventStream(global::Google.Protobuf.WellKnownTypes.Empty request); } public partial interface IResolveAppImpl { @@ -57,22 +57,22 @@ public partial interface IResolveAppImpl { } public partial interface IGetLifecycleEventStreamImpl { - Task GetLifecycleEventStream(global::Plexus.Interop.Apps.Internal.Generated.Empty request, IWritableChannel responseStream, MethodCallContext context); + Task GetLifecycleEventStream(global::Google.Protobuf.WellKnownTypes.Empty request, IWritableChannel responseStream, MethodCallContext context); } public sealed partial class Descriptor { public UnaryMethod ResolveAppMethod {get; private set; } - public ServerStreamingMethod GetLifecycleEventStreamMethod {get; private set; } + public ServerStreamingMethod GetLifecycleEventStreamMethod {get; private set; } public Descriptor() { ResolveAppMethod = Method.Unary(Id, ResolveAppMethodId); - GetLifecycleEventStreamMethod = Method.ServerStreaming(Id, GetLifecycleEventStreamMethodId); + GetLifecycleEventStreamMethod = Method.ServerStreaming(Id, GetLifecycleEventStreamMethodId); } public Descriptor(string alias) { ResolveAppMethod = Method.Unary(Id, alias, ResolveAppMethodId); - GetLifecycleEventStreamMethod = Method.ServerStreaming(Id, alias, GetLifecycleEventStreamMethodId); + GetLifecycleEventStreamMethod = Method.ServerStreaming(Id, alias, GetLifecycleEventStreamMethodId); } } } diff --git a/desktop/src/Plexus.Interop.Broker/Internal/Broker.cs b/desktop/src/Plexus.Interop.Broker/Internal/Broker.cs index 672159f85..5e0a85b2c 100644 --- a/desktop/src/Plexus.Interop.Broker/Internal/Broker.cs +++ b/desktop/src/Plexus.Interop.Broker/Internal/Broker.cs @@ -16,11 +16,6 @@ */ namespace Plexus.Interop.Internal { - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Reflection; - using System.Threading.Tasks; using Plexus.Interop.Apps; using Plexus.Interop.Broker; using Plexus.Interop.Metamodel; @@ -31,6 +26,11 @@ namespace Plexus.Interop.Internal using Plexus.Interop.Transport.Transmission.Pipes; using Plexus.Interop.Transport.Transmission.WebSockets.Server; using Plexus.Processes; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Reflection; + using System.Threading.Tasks; using ILogger = Plexus.ILogger; using LogManager = Plexus.LogManager; @@ -56,7 +56,9 @@ public Broker(string metadataDir = null, IRegistryProvider registryProvider = nu var binDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var studioDir = Path.Combine(binDir, "studio"); Log.Info("Studio dir: {0}", studioDir); - metadataDir = metadataDir ?? Path.Combine(_workingDir, "metadata"); + metadataDir = Path.GetFullPath(metadataDir ?? Path.Combine(_workingDir, "metadata")); + Log.Info("Metadata dir: {0}", metadataDir); + var metadataFile = Path.Combine(metadataDir, "interop.json"); _transportServers = new[] { TransportServerFactory.Instance.Create( @@ -64,7 +66,7 @@ public Broker(string metadataDir = null, IRegistryProvider registryProvider = nu TransportServerFactory.Instance.Create( WebSocketTransmissionServerFactory.Instance.Create( _workingDir, - new[] {("/metadata", metadataDir), ("/studio", studioDir)}), + new Dictionary{ {"/metadata/interop", metadataFile }, {"/studio", studioDir }}), DefaultTransportSerializationProvider) }; _connectionListener = new ServerConnectionListener(_transportServers); diff --git a/desktop/src/Plexus.Interop.Transport.Transmission.WebSockets.Server/Internal/WebSocketTransmissionServer.cs b/desktop/src/Plexus.Interop.Transport.Transmission.WebSockets.Server/Internal/WebSocketTransmissionServer.cs index a92c760b9..455f84bfa 100644 --- a/desktop/src/Plexus.Interop.Transport.Transmission.WebSockets.Server/Internal/WebSocketTransmissionServer.cs +++ b/desktop/src/Plexus.Interop.Transport.Transmission.WebSockets.Server/Internal/WebSocketTransmissionServer.cs @@ -32,6 +32,7 @@ namespace Plexus.Interop.Transport.Transmission.WebSockets.Server.Internal using System.Net; using System.Net.Sockets; using System.Net.WebSockets; + using System.Text; using System.Threading; using System.Threading.Tasks; using IMsLoggerFactory = Microsoft.Extensions.Logging.ILoggerFactory; @@ -44,11 +45,11 @@ internal sealed class WebSocketTransmissionServer : ProcessBase, ITransmissionSe private IWebHost _host; private readonly IChannel _buffer = new BufferedChannel(AcceptedConnectionsBufferSize); private readonly IServerStateWriter _stateWriter; - private readonly IReadOnlyCollection<(string UrlPath, string PhysicalPath)> _staticFileMappings; + private readonly IReadOnlyDictionary _staticFileMappings; - public WebSocketTransmissionServer(string workingDir, IReadOnlyCollection<(string UrlPath, string PhysicalPath)> staticFileMappings = null) + public WebSocketTransmissionServer(string workingDir, IReadOnlyDictionary staticFileMappings = null) { - _staticFileMappings = staticFileMappings ?? Array.Empty<(string, string)>(); + _staticFileMappings = staticFileMappings ?? new Dictionary(); _stateWriter = new ServerStateWriter(ServerName, workingDir); _buffer.Out.PropagateCompletionFrom(Completion); } @@ -98,6 +99,7 @@ private async Task MainThreadAsync() var url = $"http://{localhostIp}:0"; _host = new WebHostBuilder() .UseKestrel() + .SuppressStatusMessages(true) .UseUrls(url) .UseContentRoot(Directory.GetCurrentDirectory()) .Configure(Configure) @@ -124,43 +126,82 @@ private void Configure(IApplicationBuilder app) ReceiveBufferSize = PooledBuffer.MaxSize }); + foreach (var pair in _staticFileMappings) + { + if (!Directory.Exists(pair.Value)) + { + continue; + } + + app.UseStaticFiles(new StaticFileOptions + { + RequestPath = pair.Key, + FileProvider = new PhysicalFileProvider(pair.Value) + }); + } + app.Use(async (context, next) => { if (context.WebSockets.IsWebSocketRequest) { - try + var urlPath = context.Request.Path.ToString().TrimEnd('/'); + if (_staticFileMappings.TryGetValue(urlPath, out var physicalPath)) { - Log.Trace("Websocket connection received"); - var connectionTask = await AcceptWebsocketConnectionAsync(context).ConfigureAwait(false); - await connectionTask.ConfigureAwait(false); - Log.Trace("Websocket connection completed"); + if (File.Exists(physicalPath)) + { + using (var webSocket = await context.WebSockets.AcceptWebSocketAsync().ConfigureAwait(false)) + { + using (var stream = File.OpenText(physicalPath)) + { + var bytes = Encoding.UTF8.GetBytes( + await stream.ReadToEndAsync().ConfigureAwait(false)); + await webSocket + .SendAsync( + new ArraySegment(bytes), + WebSocketMessageType.Text, + true, + CancellationToken.None) + .ConfigureAwait(false); + } + + await webSocket + .CloseAsync( + WebSocketCloseStatus.NormalClosure, + "Normal Close", + CancellationToken.None) + .ConfigureAwait(false); + } + + return; + } } - catch (Exception ex) + + if (string.IsNullOrEmpty(urlPath)) { - Log.Trace("Websocket connection terminated with exception: {0}", ex.FormatTypeAndMessage()); - throw; + try + { + Log.Trace("Websocket connection received"); + var connectionTask = await AcceptWebsocketConnectionAsync(context).ConfigureAwait(false); + await connectionTask.ConfigureAwait(false); + Log.Trace("Websocket connection completed"); + } + catch (Exception ex) + { + Log.Trace("Websocket connection terminated with exception: {0}", ex.FormatTypeAndMessage()); + throw; + } + + return; } + + Log.Trace("Unknown websocket request received: {0}", context.Request.Path); } else { - Log.Trace("Non-websocket request received"); - await next().ConfigureAwait(false); + Log.Trace("Unknown request received: {0}", context.Request.Path); } + await next().ConfigureAwait(false); }); - - foreach (var (urlpath, physicalpath) in _staticFileMappings) - { - if (!Directory.Exists(physicalpath)) - { - continue; - } - - app.UseStaticFiles(new StaticFileOptions - { - RequestPath = urlpath, - FileProvider = new PhysicalFileProvider(physicalpath), - }); - } } private async Task AcceptWebsocketConnectionAsync(HttpContext context) diff --git a/desktop/src/Plexus.Interop.Transport.Transmission.WebSockets.Server/WebSocketTransmissionServerFactory.cs b/desktop/src/Plexus.Interop.Transport.Transmission.WebSockets.Server/WebSocketTransmissionServerFactory.cs index 9054b6aaf..bd3493cb9 100644 --- a/desktop/src/Plexus.Interop.Transport.Transmission.WebSockets.Server/WebSocketTransmissionServerFactory.cs +++ b/desktop/src/Plexus.Interop.Transport.Transmission.WebSockets.Server/WebSocketTransmissionServerFactory.cs @@ -23,7 +23,7 @@ public sealed class WebSocketTransmissionServerFactory { public static WebSocketTransmissionServerFactory Instance = new WebSocketTransmissionServerFactory(); - public ITransmissionServer Create(string workingDir, IReadOnlyCollection<(string UrlPath, string PhysicalPath)> staticFileMappings = null) + public ITransmissionServer Create(string workingDir, IReadOnlyDictionary staticFileMappings = null) { return new WebSocketTransmissionServer(workingDir, staticFileMappings); } diff --git a/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpCodeGenerator.xtend b/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpCodeGenerator.xtend index b3574a8b2..49c591e75 100644 --- a/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpCodeGenerator.xtend +++ b/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpCodeGenerator.xtend @@ -425,9 +425,6 @@ class CsharpCodeGenerator { if (option !== null) { ns = (option.value as StringConstant).value } - if (config.namespace !== null) { - ns = config.namespace; - } return ns } diff --git a/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpGenTask.xtend b/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpGenTask.xtend index b9c9441a1..3ce04f653 100644 --- a/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpGenTask.xtend +++ b/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpGenTask.xtend @@ -47,6 +47,9 @@ class CsharpGenTask extends BaseGenTask { var internalAccessArg = "" if (config.namespace !== null && config.namespace.startsWith("internal_access:")) { config.namespace = config.namespace.substring("internal_access:".length) + if (config.namespace.isEmpty) { + config.namespace = null + } accessModifier = "internal" internalAccessArg = "internal_access:" } @@ -57,8 +60,12 @@ class CsharpGenTask extends BaseGenTask { val resources = resourceSet.resources; for (resource : resources) { + val isBuiltIn = resource.URI.segmentCount > 2 + && resource.URI.segment(resource.URI.segmentCount - 3).equals("google") + && resource.URI.segment(resource.URI.segmentCount - 2).equals("protobuf") if (!resource.URI.toString.endsWith(ProtoLangUtils.DESCRIPTOR_RESOURCE_PATH) - && !resource.URI.toString.endsWith(InteropLangUtils.DESCRIPTOR_RESOURCE_PATH)) + && !resource.URI.toString.endsWith(InteropLangUtils.DESCRIPTOR_RESOURCE_PATH) + && !isBuiltIn) { var newUri = resource.URI.resolve(workingDirUri) var path = newUri.toFileString @@ -66,7 +73,7 @@ class CsharpGenTask extends BaseGenTask { newUri = newUri.deresolve(baseDirUri).resolve(outDirUri) } else { newUri = newUri.deresolve(resourceBaseUri).resolve(outDirUri) - } + } if (newUri.toString.endsWith(".proto")) { val newPath = newUri.toFileString val file = new File(newPath) diff --git a/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpProtoGenTask.xtend b/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpProtoGenTask.xtend index 2df15f68a..77e1cead9 100644 --- a/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpProtoGenTask.xtend +++ b/dsl/gen/csharp/src/main/java/com/db/plexus/interop/dsl/gen/csharp/CsharpProtoGenTask.xtend @@ -37,23 +37,26 @@ class CsharpProtoGenTask extends ProtoGenTask { override protected doGenWithResources(PlexusGenConfig config, XtextResourceSet resourceSet) throws IOException { var namespace = config.namespace; - if (config.namespace !== null) { + if (namespace !== null) { if (namespace.startsWith("internal_access:")) { namespace = namespace.substring("internal_access:".length) + } + if (!namespace.isEmpty) { + val description = utils.getDescriptorResourceDescription(resourceSet) + val optionDescriptor = description.getExportedObjects( + ProtobufPackage.Literals.FIELD, + CSHARP_NAMESPACE_OPTION_DESCRIPTOR_NAME, + false + ) + .findFirst[x | true].EObjectOrProxy as Field + val csharpNamespaceOption = ProtobufFactory.eINSTANCE.createOption() + csharpNamespaceOption.isCustom = false + csharpNamespaceOption.descriptor = optionDescriptor + val stringConstant = ProtobufFactory.eINSTANCE.createStringConstant() + stringConstant.value = namespace + csharpNamespaceOption.value = stringConstant + super.customOptions.add(csharpNamespaceOption) } - val description = utils.getDescriptorResourceDescription(resourceSet) - val optionDescriptor = description.getExportedObjects( - ProtobufPackage.Literals.FIELD, - CSHARP_NAMESPACE_OPTION_DESCRIPTOR_NAME, - false - ).findFirst[x | true].EObjectOrProxy as Field - val csharpNamespaceOption = ProtobufFactory.eINSTANCE.createOption() - csharpNamespaceOption.isCustom = false - csharpNamespaceOption.descriptor = optionDescriptor - val stringConstant = ProtobufFactory.eINSTANCE.createStringConstant() - stringConstant.value = namespace - csharpNamespaceOption.value = stringConstant - super.customOptions.add(csharpNamespaceOption) } super.doGenWithResources(config, resourceSet) diff --git a/dsl/gen/proto/src/main/java/com/db/plexus/interop/dsl/gen/proto/ProtoGenTask.xtend b/dsl/gen/proto/src/main/java/com/db/plexus/interop/dsl/gen/proto/ProtoGenTask.xtend index dc9b16811..6895fc506 100644 --- a/dsl/gen/proto/src/main/java/com/db/plexus/interop/dsl/gen/proto/ProtoGenTask.xtend +++ b/dsl/gen/proto/src/main/java/com/db/plexus/interop/dsl/gen/proto/ProtoGenTask.xtend @@ -125,8 +125,9 @@ public class ProtoGenTask extends BaseGenTask { val uriStr = r.URI.toString() val isProto = uriStr.endsWith(".proto") val isDescriptorProto = isProto && (uriStr.endsWith(GenUtils.PROTOBUF_DESCRIPTOR_RESOURCE_PATH) || uriStr.endsWith(GenUtils.INTEROP_DESCRIPTOR_RESOURCE_PATH)) - val needAddCustomOptions = !isDescriptorProto - val needAddPlexusOptions = !isDescriptorProto && !uriStr.endsWith(GenUtils.INTEROP_OPTIONS_RESOURCE_PATH) + var isBuiltIn = r.URI.segmentCount > 2 && r.URI.segment(r.URI.segmentCount - 2).equals("protobuf") && r.URI.segment(r.URI.segmentCount - 3).equals("google") + val needAddCustomOptions = !isBuiltIn && !isDescriptorProto + val needAddPlexusOptions = !isBuiltIn && !isDescriptorProto && !uriStr.endsWith(GenUtils.INTEROP_OPTIONS_RESOURCE_PATH) val root = r.contents.get(0) as Proto val firstDefinition = root.elements.findFirst[x|x instanceof NamedElement] diff --git a/web/packages/broker/src/broker/InvocationRequestHandler.ts b/web/packages/broker/src/broker/InvocationRequestHandler.ts index b8ff3dfcd..e466a268c 100644 --- a/web/packages/broker/src/broker/InvocationRequestHandler.ts +++ b/web/packages/broker/src/broker/InvocationRequestHandler.ts @@ -179,7 +179,7 @@ export class InvocationRequestHandler { appConnection = onlineApps.find(a => connectionId.equals(a.connection.uuid())); } else if (methodReference.providedService && methodReference.providedService.applicationId) { this.log.trace(`Looking for app by app id [${methodReference.providedService.applicationId}]`); - appConnection = this.appLifeCycleManager.getOrSpawnConnection(methodReference.providedService.applicationId); + appConnection = this.appLifeCycleManager.getOrSpawnConnection(methodReference.providedService.applicationId, sourceConnection.instanceId); } if (!appConnection) { throw new Error('Requested application is not online'); @@ -187,8 +187,9 @@ export class InvocationRequestHandler { return appConnection; } else { const targetMethods = this.registryService.getMatchingProvidedMethods(sourceConnection.applicationId, methodReference); - const targetAppIds = targetMethods.map(method => method.providedService.application.id); - const appConnection = await this.appLifeCycleManager.getOrSpawnConnectionForOneOf(targetAppIds); + const targetAppIds = targetMethods + .map(method => method.providedService.application.id); + const appConnection = await this.appLifeCycleManager.getOrSpawnConnectionForOneOf(targetAppIds, sourceConnection.instanceId); return appConnection; } } diff --git a/web/packages/broker/src/index.ts b/web/packages/broker/src/index.ts index b7a0db048..654a2bc76 100644 --- a/web/packages/broker/src/index.ts +++ b/web/packages/broker/src/index.ts @@ -18,4 +18,5 @@ export * from './api'; export * from './bus'; export * from './metadata'; export * from './launcher'; -export * from './io'; \ No newline at end of file +export * from './io'; +export * from './ws/WebSocketDataProvider'; \ No newline at end of file diff --git a/web/packages/broker/src/lifecycle/AppLifeCycleManager.ts b/web/packages/broker/src/lifecycle/AppLifeCycleManager.ts index ddca9b139..a8d0b3389 100644 --- a/web/packages/broker/src/lifecycle/AppLifeCycleManager.ts +++ b/web/packages/broker/src/lifecycle/AppLifeCycleManager.ts @@ -24,9 +24,9 @@ export interface AppLifeCycleManager { spawnConnection(applicationId: string): Promise; - getOrSpawnConnection(applicationId: string): Promise; + getOrSpawnConnection(applicationId: string, excludedInstance?: string): Promise; - getOrSpawnConnectionForOneOf(applicationIds: string[]): Promise; + getOrSpawnConnectionForOneOf(applicationIds: string[], excludedInstance?: string): Promise; acceptConnection(connection: TransportConnection, appDescriptor: ApplicationDescriptor, connectionDropped: (connection: ApplicationConnection) => void): Promise; diff --git a/web/packages/broker/src/metadata/interop/json/UrlInteropRegistryProvider.ts b/web/packages/broker/src/metadata/interop/json/UrlInteropRegistryProvider.ts index 70fbdfab5..3a6fa798e 100644 --- a/web/packages/broker/src/metadata/interop/json/UrlInteropRegistryProvider.ts +++ b/web/packages/broker/src/metadata/interop/json/UrlInteropRegistryProvider.ts @@ -20,6 +20,8 @@ import { InteropRegistry } from '../model/InteropRegistry'; import { Logger, LoggerFactory } from '@plexus-interop/common'; import { UrlDataLoader } from '../../../http/UrlDataLoader'; import { JsonInteropRegistryProvider } from './JsonInteropRegistryProvider'; +import { WebSocketDataProvider } from '../../../ws/WebSocketDataProvider'; +import 'rxjs/add/operator/throttleTime'; export class UrlInteropRegistryProvider implements InteropRegistryProvider { @@ -27,6 +29,8 @@ export class UrlInteropRegistryProvider implements InteropRegistryProvider { private urlDataLoader: UrlDataLoader = new UrlDataLoader(); + private webSocketDataProvider: WebSocketDataProvider = new WebSocketDataProvider(); + private jsonInteropRegistryProvider: JsonInteropRegistryProvider; private started: boolean = false; @@ -51,6 +55,15 @@ export class UrlInteropRegistryProvider implements InteropRegistryProvider { return Promise.reject('Already started'); } this.log.debug(`Starting to load metadata from [${this.url}] with ${this.interval} interval`); + const isWebSocket = this.url.startsWith('ws'); + if (isWebSocket) { + await this.startWithWebSocket(); + } else { + await this.startWithHttp(); + } + } + + private async startWithHttp(): Promise { const response = await this.urlDataLoader.fetchData(this.url); if (this.interval > 0) { this.jsonInteropRegistryProvider = new JsonInteropRegistryProvider(response, this.urlDataLoader.fetchWithInterval(this.url, this.interval)); @@ -60,4 +73,14 @@ export class UrlInteropRegistryProvider implements InteropRegistryProvider { this.started = true; } + private async startWithWebSocket(): Promise { + const response = await this.webSocketDataProvider.getSingleMessage(this.url); + if (this.interval > 0) { + this.jsonInteropRegistryProvider = new JsonInteropRegistryProvider(response, this.webSocketDataProvider.getData(this.url).throttleTime(this.interval)); + } else { + this.jsonInteropRegistryProvider = new JsonInteropRegistryProvider(response); + } + this.started = true; + } + } \ No newline at end of file diff --git a/web/packages/broker/src/peers/PeerAppLifeCycleManager.ts b/web/packages/broker/src/peers/PeerAppLifeCycleManager.ts index c694247dd..25b1bf1d0 100644 --- a/web/packages/broker/src/peers/PeerAppLifeCycleManager.ts +++ b/web/packages/broker/src/peers/PeerAppLifeCycleManager.ts @@ -83,8 +83,8 @@ export class PeerAppLifeCycleManager implements AppLifeCycleManager { return appConnection; } - public async getOrSpawnConnection(applicationId: string): Promise { - return this.getOrSpawnConnectionForOneOf([applicationId]); + public async getOrSpawnConnection(applicationId: string, excludedInstance?: string): Promise { + return this.getOrSpawnConnectionForOneOf([applicationId], excludedInstance); } public async spawnConnection(applicationId: string): Promise { @@ -115,8 +115,10 @@ export class PeerAppLifeCycleManager implements AppLifeCycleManager { } } - public async getOrSpawnConnectionForOneOf(applicationIds: string[]): Promise { + public async getOrSpawnConnectionForOneOf(applicationIds: string[], excludedInstance?: string): Promise { const appConnections = this.getOnlineConnectionsInternal() + // do not match excluded if provided + .filter(connection => !excludedInstance || connection.descriptor.instanceId !== excludedInstance) .filter(connection => applicationIds.indexOf(connection.descriptor.applicationId) >= 0); return appConnections.length > 0 ? appConnections[0] : this.spawnConnection(applicationIds[0]); } diff --git a/web/packages/broker/src/ws/WebSocketDataProvider.ts b/web/packages/broker/src/ws/WebSocketDataProvider.ts new file mode 100644 index 000000000..68f1f2819 --- /dev/null +++ b/web/packages/broker/src/ws/WebSocketDataProvider.ts @@ -0,0 +1,53 @@ +/** + * Copyright 2017-2018 Plexus Interop Deutsche Bank AG + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Observable } from 'rxjs/Observable'; +import { webSocket } from 'rxjs/observable/dom/webSocket'; +import { WebSocketSubjectConfig } from 'rxjs/observable/dom/WebSocketSubject'; + +export class WebSocketDataProvider { + + public getData(url: string): Observable { + return webSocket(this.config(url)); + } + + public getSingleMessage(url: string): Promise { + return new Promise((resolve, reject) => { + let resolved = false; + let subscription = this.getData(url).subscribe({ + next: (message: string) => { + resolved = true; + resolve(message); + }, + error: e => reject(e), + complete: () => { + if (!resolved) { + reject(new Error('No data received')); + } + } + }); + }); + } + + private config(url: string): WebSocketSubjectConfig { + return { + url, + // override default behavior, which invokes JSON.parse + resultSelector: e => e.data + }; + } + +} \ No newline at end of file diff --git a/web/packages/cli/src/commands/BaseJavaGenCommand.ts b/web/packages/cli/src/commands/BaseJavaGenCommand.ts index a776d6181..474a4adda 100644 --- a/web/packages/cli/src/commands/BaseJavaGenCommand.ts +++ b/web/packages/cli/src/commands/BaseJavaGenCommand.ts @@ -25,7 +25,7 @@ export abstract class BaseJavaGenCommand extends BaseCommand { public async action(opts: any): Promise { const javaExecPath = await getJavaExecPath(); const javaLibPath = getJavaGenLibPath(); - return simpleSpawn(javaExecPath, ['-jar', javaLibPath, ...this.plexusGenArgs(opts)], opts.verbose === 'true'); + return simpleSpawn(javaExecPath, ['-jar', javaLibPath, ...this.plexusGenArgs(opts)], !!opts.verbose); } } diff --git a/web/packages/cli/src/common/process.ts b/web/packages/cli/src/common/process.ts index c0f7383fd..2f504dd97 100644 --- a/web/packages/cli/src/common/process.ts +++ b/web/packages/cli/src/common/process.ts @@ -33,12 +33,13 @@ export function simpleSpawn(execPath: string, args: string[] = [], printOutput: }); child.on('exit', (code, signal) => { if (code !== 0) { - reject(new Error(`Child process completed with error code: ${code}`)); + reject(new Error(`Child process completed with error code: ${code}, please use --verbose flag to see whole output`)); } else { resolve(); } }); child.on('error', error => { + console.error('Process finished with error', error); reject(error); }); }); diff --git a/web/packages/client/src/client/api/container/DefaultConnectionDetailsService.ts b/web/packages/client/src/client/api/container/DefaultConnectionDetailsService.ts index 9bf7a0035..5160bf73d 100644 --- a/web/packages/client/src/client/api/container/DefaultConnectionDetailsService.ts +++ b/web/packages/client/src/client/api/container/DefaultConnectionDetailsService.ts @@ -21,7 +21,7 @@ import { Logger, LoggerFactory } from '@plexus-interop/common'; export class DefaultConnectionDetailsService implements ConnectionDetailsService { private readonly log: Logger = LoggerFactory.getLogger('DefaultConnectionDetailsService'); - + public getConnectionDetails(): Promise { const globalObj = self as any; if (globalObj.plexus && globalObj.plexus.getConnectionDetails) { @@ -34,7 +34,11 @@ export class DefaultConnectionDetailsService implements ConnectionDetailsService public getMetadataUrl(): Promise { return this.getConnectionDetails() - .then(details => `http://localhost:${details.ws.port}/metadata/interop.json`); + .then(details => this.getDefaultUrl(`ws://127.0.0.1:${details.ws.port}`)); + } + + public getDefaultUrl(baseUrl: string): string { + return `${baseUrl}/metadata/interop`; } - + } \ No newline at end of file diff --git a/web/packages/e2e/package.json b/web/packages/e2e/package.json index 339e2a0e6..b77ae7b5f 100644 --- a/web/packages/e2e/package.json +++ b/web/packages/e2e/package.json @@ -21,7 +21,7 @@ "copy-assets": "copyfiles src/echo/gen/* dist/main && copyfiles src/views/* dist/main", "republish": "echo 'Not implemented'", "build-host-proxy": "node scripts/browserify-all.js --standalone proxyHost --inputGlob dist/main/tests/common/TestCrossDomainHost.js --outputFile dist/main/tests/web/CrossDomainHost.bundle.js", - "prepare-native-e2e-debug-tests": "node scripts/browserify-all.js --inputGlob dist/main/tests/native/*Point*spec.js --outputFile dist/main/tests/native/RendererProcess.bundle.js", + "prepare-native-e2e-debug-tests": "node scripts/browserify-all.js --inputGlob dist/main/tests/native/*Metadata*spec.js --outputFile dist/main/tests/native/RendererProcess.bundle.js", "e2e-web-electron": "node scripts/web-e2e-tests-launcher.js --file ./dist/main/tests/web/RendererProcess.bundle.js", "pree2e-web-electron": "node scripts/browserify-all.js --brokerCoverage true --inputGlob dist/main/tests/web/*spec.js --outputFile dist/main/tests/web/RendererProcess.bundle.js", "e2e-web-ie": "node scripts/web-e2e-tests-launcher.js --browser ie", diff --git a/web/packages/e2e/tests/native/WebSocketMetadataLoader.spec.ts b/web/packages/e2e/tests/native/WebSocketMetadataLoader.spec.ts new file mode 100644 index 000000000..8e7328ced --- /dev/null +++ b/web/packages/e2e/tests/native/WebSocketMetadataLoader.spec.ts @@ -0,0 +1,46 @@ +/** + * Copyright 2017-2018 Plexus Interop Deutsche Bank AG + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DefaultConnectionDetailsService } from '@plexus-interop/client'; +import { readWsUrl } from '../common/utils'; +import { WebSocketDataProvider, UrlInteropRegistryProvider } from '@plexus-interop/broker'; +import { expect } from 'chai'; + +const wsUrl = readWsUrl(); +const metadataUrl = new DefaultConnectionDetailsService().getDefaultUrl(wsUrl); + +describe('WebSocket metadata loader', () => { + + it('Loads metadata from default url', async () => { + const loader = new WebSocketDataProvider(); + const metadata = await loader.getSingleMessage(metadataUrl); + expect(metadata).contains('applications'); + }); + +}); + +describe('URL Metadata Data loader', () => { + + it('Loads and parses metadata from Web Socket URL', async () => { + const wsUrl = readWsUrl(); + const urlMetadataProvider = new UrlInteropRegistryProvider(metadataUrl); + await urlMetadataProvider.start(); + const registry = urlMetadataProvider.getCurrent(); + expect(registry.applications.valuesArray().length).to.be.greaterThan(0); + }); + +}); \ No newline at end of file diff --git a/web/packages/protocol/package.json b/web/packages/protocol/package.json index d46ddec6b..9862e5e27 100644 --- a/web/packages/protocol/package.json +++ b/web/packages/protocol/package.json @@ -16,11 +16,7 @@ "gen-transport-ts": "pbts --force-long -o src/gen/internal-transport-protocol.d.ts src/gen/internal-transport-protocol.js", "gen-client-protocol": "npm run gen-client-js && npm run gen-client-ts", "gen-transport-protocol": "npm run gen-transport-js && npm run gen-transport-ts", - "unpublish": "npm unpublish @plexus-interop/protocol@0.1.2", - "postunpublish": "echo 'Unpublished'", - "prerepublish": "echo 'Republishing started...'", - "republish": "npm run unpublish && npm publish", - "postrepublish": "echo 'Package republished successfully!'" + "test": "jest --coverage" }, "dependencies": { "@types/long": "^3.0.31", @@ -31,10 +27,29 @@ "protobufjs": "6.8.0" }, "devDependencies": { + "@types/jest": "^22.0.0", + "@types/long": "^3.0.31", + "@types/node": "^7.0.5", "trash-cli": "^1.4.0", "typescript": "2.6.1", "yarn": "1.4.0", "copyfiles": "^1.2.0", + "jest": "22.4.1", "espree": "^3.4.3" + }, + "jest": { + "testEnvironment": "node", + "moduleFileExtensions": [ + "ts", + "js" + ], + "testRegex": ".+/dist/main/tests/.+.spec.js$", + "coverageDirectory": "coverage", + "collectCoverageFrom": [ + "dist/main/src/**/*.js", + "!src/*.d.ts", + "!src/**/*.d.ts", + "!src/**/*.spec.ts" + ] } } diff --git a/web/packages/protocol/src/dto/UniqueId.ts b/web/packages/protocol/src/dto/UniqueId.ts index e41496c57..25a46c121 100644 --- a/web/packages/protocol/src/dto/UniqueId.ts +++ b/web/packages/protocol/src/dto/UniqueId.ts @@ -57,4 +57,4 @@ export class UniqueId { function longToString(x: number | Long | undefined): string { return x ? x.toString(16).toUpperCase() : 'undefined'; -} +} \ No newline at end of file diff --git a/web/packages/protocol/tests/dto/UniqueId.spec.ts b/web/packages/protocol/tests/dto/UniqueId.spec.ts new file mode 100644 index 000000000..aec6e38e7 --- /dev/null +++ b/web/packages/protocol/tests/dto/UniqueId.spec.ts @@ -0,0 +1,30 @@ +/** + * Copyright 2017-2018 Plexus Interop Deutsche Bank AG + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { UniqueId } from '../../src/dto/UniqueId'; + +describe('UniqueId', () => { + it('Converts guid to string and back', () => { + const id = UniqueId.generateNew(); + const strId = id.toString(); + expect(UniqueId.fromString(strId).toString()).toBe(strId); + }); + it('Converts id to 32 lengh string', () => { + const id = UniqueId.generateNew(); + const strId = id.toString(); + expect(id.toString().length).toBe(32); + }); +}); \ No newline at end of file diff --git a/web/packages/protocol/tsconfig.json b/web/packages/protocol/tsconfig.json index 6c1b4a33c..377706698 100644 --- a/web/packages/protocol/tsconfig.json +++ b/web/packages/protocol/tsconfig.json @@ -19,9 +19,12 @@ "sourceMap": true, "pretty": true, "lib": [ - "es6", "dom" + "es6", + "dom" ], "types": [ + "node", + "jest", "long" ], "baseUrl": "." diff --git a/web/packages/studio/src/app/header/header.component.html b/web/packages/studio/src/app/header/header.component.html index 1fa067fd3..d30d5872f 100644 --- a/web/packages/studio/src/app/header/header.component.html +++ b/web/packages/studio/src/app/header/header.component.html @@ -7,7 +7,7 @@