Exemple #1
0
        public async Task <IExplorerItem> Load(bool reloadCatalogue)
        {
            if (!Connection.IsConnected)
            {
                ShowServerDisconnectedPopup();
                return(new ServerExplorerItem());
            }

            var comsController = CommunicationControllerFactory.CreateController("FetchExplorerItemsService");

            comsController.AddPayloadArgument("ReloadResourceCatalogue", reloadCatalogue.ToString());

            if (Connection.IsLocalHost)
            {
                var result = await comsController.ExecuteCompressedCommandAsync <IExplorerItem>(Connection, GlobalConstants.ServerWorkspaceID).ConfigureAwait(true);

                return(result);
            }
            else
            {
                var fetchExplorerTask = comsController.ExecuteCompressedCommandAsync <IExplorerItem>(Connection, GlobalConstants.ServerWorkspaceID);
                var delayTask         = Task.Delay(60000).ContinueWith((t) =>
                {
                    if (fetchExplorerTask.Status != TaskStatus.RanToCompletion)
                    {
                        var popupController = CustomContainer.Get <IPopupController>();
                        popupController?.Show(string.Format(ErrorResource.ServerBusyError, Connection.DisplayName), ErrorResource.ServerBusyHeader, MessageBoxButton.OK,
                                              MessageBoxImage.Warning, "", false, false, true, false, false, false);
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
                var result = await fetchExplorerTask.ConfigureAwait(true);

                return(result);
            }
        }
Exemple #2
0
        public IList <Guid> FetchDependenciesOnList(IEnumerable <Guid> values)
        {
            if (!Connection.IsConnected)
            {
                ShowServerDisconnectedPopup();
                return(new List <Guid>());
            }

            var enumerable = values as Guid[] ?? values.ToArray();

            if (!enumerable.Any())
            {
                return(new List <Guid>());
            }

            var serializer     = new Dev2JsonSerializer();
            var comsController = CommunicationControllerFactory.CreateController("GetDependanciesOnListService");

            comsController.AddPayloadArgument("ResourceIds", serializer.SerializeToBuilder(enumerable.Select(a => a.ToString()).ToList()));
            comsController.AddPayloadArgument("GetDependsOnMe", "false");
            var res = comsController.ExecuteCommand <List <string> >(Connection, GlobalConstants.ServerWorkspaceID).Where(a =>
            {
                Guid.TryParse(a, out Guid b);
                return(b != Guid.Empty);
            });
            var result = res.Select(Guid.Parse).ToList();

            if (result == null)
            {
                throw new Exception(string.Format(GlobalConstants.NetworkCommunicationErrorTextFormat, "GetDependanciesOnListService"));
            }

            return(result);
        }
Exemple #3
0
        public Task <List <string> > LoadDuplicates()
        {
            var comsController = CommunicationControllerFactory.CreateController("FetchResourceDuplicates");
            var result         = comsController.ExecuteCompressedCommandAsync <List <string> >(Connection, GlobalConstants.ServerWorkspaceID);

            return(result);
        }
Exemple #4
0
        public IList <string> GetComputerNames()
        {
            var comsController = CommunicationControllerFactory.CreateController("GetComputerNamesService");

            var workspaceId = Connection.WorkspaceID;
            var result      = comsController.ExecuteCommand <ExecuteMessage>(Connection, workspaceId);

            if (result == null || result.HasError)
            {
                if (!Connection.IsConnected)
                {
                    var application = Application.Current;
                    application?.Dispatcher?.BeginInvoke(new Action(ShowServerDisconnectedPopup));
                    return(new List <string>());
                }
                if (result != null)
                {
                    throw new WarewolfSupportServiceException(result.Message.ToString(), null);
                }
                throw new WarewolfSupportServiceException(ErrorResource.ServiceDoesNotExist, null);
            }
            var serializer = new Dev2JsonSerializer();

            return(serializer.Deserialize <IList <string> >(result.Message.ToString()));
        }
Exemple #5
0
        public ICollection <INamespaceItem> FetchNamespacesWithJsonRetunrs(IPluginSource source)
        {
            var serializer     = new Dev2JsonSerializer();
            var comsController = CommunicationControllerFactory.CreateController("FetchPluginNameSpaces");

            comsController.AddPayloadArgument(nameof(source), serializer.SerializeToBuilder(source));
            comsController.AddPayloadArgument("fetchJson", new StringBuilder(true.ToString()));
            var workspaceId = Connection.WorkspaceID;
            var payload     = comsController.ExecuteCommand <ExecuteMessage>(Connection, workspaceId);

            if (payload == null || payload.HasError)
            {
                if (!Connection.IsConnected)
                {
                    ShowServerDisconnectedPopup();
                    return(new List <INamespaceItem>());
                }
                if (payload != null)
                {
                    throw new WarewolfSupportServiceException(payload.Message.ToString(), null);
                }
                throw new WarewolfSupportServiceException(ErrorResource.ServiceDoesNotExist, null);
            }
            return(serializer.Deserialize <List <INamespaceItem> >(payload.Message));
        }
Exemple #6
0
        public IList <IPluginAction> PluginActions(IComPluginSource source, INamespaceItem ns)
        {
            var serializer     = new Dev2JsonSerializer();
            var comsController = CommunicationControllerFactory.CreateController("FetchComPluginActions");

            comsController.AddPayloadArgument(nameof(source), serializer.SerializeToBuilder(source));
            comsController.AddPayloadArgument("namespace", serializer.SerializeToBuilder(ns));
            var workspaceId = Connection.WorkspaceID;
            var result      = comsController.ExecuteCommand <ExecuteMessage>(Connection, workspaceId);

            if (result == null || result.HasError)
            {
                if (!Connection.IsConnected)
                {
                    ShowServerDisconnectedPopup();
                    return(new List <IPluginAction>());
                }
                if (result != null)
                {
                    throw new WarewolfSupportServiceException(result.Message.ToString(), null);
                }
                throw new WarewolfSupportServiceException(ErrorResource.ServiceDoesNotExist, null);
            }

            return(serializer.Deserialize <List <IPluginAction> >(result.Message.ToString()));
        }
Exemple #7
0
        public IExplorerItem Load(ResourceType type, Guid workSpaceId)
        {
            var controller =
                CommunicationControllerFactory.CreateController("Management Services\\FetchExplorerItemsServiceByType");

            return(controller.ExecuteCommand <IExplorerItem>(Connection, workSpaceId));
        }
Exemple #8
0
        public List <IFileListing> GetComDllListings(IFileListing listing)
        {
            var serializer     = new Dev2JsonSerializer();
            var comsController = CommunicationControllerFactory.CreateController("GetComDllListingsService");

            comsController.AddPayloadArgument("currentDllListing", serializer.Serialize(listing));
            var workspaceId = Connection.WorkspaceID;
            var result      = comsController.ExecuteCommand <ExecuteMessage>(Connection, workspaceId);

            if (result == null || result.HasError)
            {
                if (!Connection.IsConnected)
                {
                    ShowServerDisconnectedPopup();
                    return(new List <IFileListing>());
                }
                if (result != null)
                {
                    throw new WarewolfSupportServiceException(result.Message.ToString(), null);
                }
                throw new WarewolfSupportServiceException(ErrorResource.ServiceDoesNotExist, null);
            }
            var dllListings = serializer.Deserialize <List <IFileListing> >(result.Message.ToString());

            return(dllListings);
        }
Exemple #9
0
        public IList <IWcfAction> WcfActions(IWcfServerSource source)
        {
            var serializer     = new Dev2JsonSerializer();
            var comsController = CommunicationControllerFactory.CreateController("FetchWcfAction");

            comsController.AddPayloadArgument("WcfSource", serializer.SerializeToBuilder(source));
            var workspaceId = Connection.WorkspaceID;
            var payload     = comsController.ExecuteCommand <ExecuteMessage>(Connection, workspaceId);

            if (payload == null || payload.HasError)
            {
                if (!Connection.IsConnected)
                {
                    ShowServerDisconnectedPopup();
                    return(new List <IWcfAction>());
                }
                if (payload != null)
                {
                    throw new WarewolfSupportServiceException(payload.Message.ToString(), null);
                }
                throw new WarewolfSupportServiceException(ErrorResource.ServiceDoesNotExist, null);
            }

            return(serializer.Deserialize <IList <IWcfAction> >(payload.Message));
        }
Exemple #10
0
        public IEnumerable <IElasticsearchSourceDefinition> FetchElasticsearchServiceSources()
        {
            var comsController = CommunicationControllerFactory.CreateController(nameof(FetchElasticsearchServiceSources));

            var workspaceId = Connection.WorkspaceID;
            var result      = comsController.ExecuteCommand <ExecuteMessage>(Connection, workspaceId);

            if (result == null || result.HasError)
            {
                if (!Connection.IsConnected)
                {
                    return(new List <IElasticsearchSourceDefinition>());
                }
                if (result != null)
                {
                    throw new WarewolfSupportServiceException(result.Message.ToString(), null);
                }
                throw new WarewolfSupportServiceException(ErrorResource.ServiceDoesNotExist, null);
            }
            var serializer = new Dev2JsonSerializer();

            var elasticsearchServiceSources = serializer.Deserialize <List <IElasticsearchSourceDefinition> >(result.Message.ToString());

            return(elasticsearchServiceSources);
        }
Exemple #11
0
        /// <summary>
        /// Gets the Warewolf Server version
        /// </summary>
        /// <returns>The version of the Server. Default version text of "Not Available." is returned
        /// if the server is older than that version.</returns>
        public string GetServerVersion()
        {
            var controller = CommunicationControllerFactory.CreateController("GetServerVersion");
            var version    = controller.ExecuteCommand <string>(Connection, Guid.Empty);

            return(string.IsNullOrEmpty(version) ? Warewolf.Studio.Resources.Languages.Core.ServerVersionUnavailable : version);
        }
Exemple #12
0
        public void TestConnection(ISharepointServerSource resource)
        {
            var con              = Connection;
            var comsController   = CommunicationControllerFactory.CreateController("TestSharepointServerService");
            var serialiser       = new Dev2JsonSerializer();
            var sharepointSource = new SharepointSource
            {
                AuthenticationType = resource.AuthenticationType,
                Password           = resource.Password,
                Server             = resource.Server,
                UserName           = resource.UserName,
                ResourceName       = resource.Name,
                ResourceID         = resource.Id
            };

            comsController.AddPayloadArgument("SharepointServer", serialiser.SerializeToBuilder(sharepointSource));
            var output = comsController.ExecuteCommand <SharepointSourceTo>(con, GlobalConstants.ServerWorkspaceID);

            if (output == null || output.TestMessage.Contains("Failed"))
            {
                if (output == null)
                {
                    throw new WarewolfTestException("No Test Response returned", null);
                }
                throw new WarewolfTestException(ErrorResource.UnableToContactServer + " : " + output.TestMessage, null);
            }
            resource.IsSharepointOnline = output.IsSharepointOnline;
        }
        public IEnumerable <IRabbitMQServiceSourceDefinition> FetchRabbitMQServiceSources()
        {
            var comsController = CommunicationControllerFactory.CreateController("FetchRabbitMQServiceSources");

            var workspaceId = Connection.WorkspaceID;
            var result      = comsController.ExecuteCommand <ExecuteMessage>(Connection, workspaceId);

            if (result == null || result.HasError)
            {
                if (!Connection.IsConnected)
                {
                    ShowServerDisconnectedPopup();
                    return(new List <IRabbitMQServiceSourceDefinition>());
                }
                if (result != null)
                {
                    throw new WarewolfSupportServiceException(result.Message.ToString(), null);
                }
                throw new WarewolfSupportServiceException(ErrorResource.ServiceDoesNotExist, null);
            }
            Dev2JsonSerializer serializer = new Dev2JsonSerializer();
            // ReSharper disable once InconsistentNaming
            List <IRabbitMQServiceSourceDefinition> rabbitMQServiceSources = serializer.Deserialize <List <IRabbitMQServiceSourceDefinition> >(result.Message.ToString());

            return(rabbitMQServiceSources);
        }
Exemple #14
0
        public string GetMinSupportedServerVersion()
        {
            var controller = CommunicationControllerFactory.CreateController("GetMinSupportedVersion");
            var version    = controller.ExecuteCommand <string>(Connection, Guid.Empty);

            return(version);
        }
Exemple #15
0
        public Dictionary <string, string> GetServerInformation()
        {
            var controller  = CommunicationControllerFactory.CreateController("GetServerInformation");
            var information = controller.ExecuteCommand <Dictionary <string, string> >(Connection, Guid.Empty);

            return(information);
        }
        public static string ExecuteServiceOnLocalhostUsingProxy(string serviceName, Dictionary <string, string> payloadArguments)
        {
            CommunicationControllerFactory fact = new CommunicationControllerFactory();
            var comm = fact.CreateController(serviceName);
            var prx  = new ServerProxy("http://localhost:3142", CredentialCache.DefaultNetworkCredentials, AsyncWorkerTests.CreateSynchronousAsyncWorker().Object);

            prx.Connect(Guid.NewGuid());
            foreach (var payloadArgument in payloadArguments)
            {
                comm.AddPayloadArgument(payloadArgument.Key, payloadArgument.Value);
            }
            if (comm != null)
            {
                var messageToExecute = comm.ExecuteCommand <ExecuteMessage>(prx, Guid.Empty);
                if (messageToExecute != null)
                {
                    var responseMessage = messageToExecute.Message;
                    if (responseMessage != null)
                    {
                        var actual = responseMessage.ToString();
                        return(actual);
                    }
                    return("Error: response message empty!");
                }
                return("Error: message to send to localhost server could not be generated.");
            }
            return("Error: localhost server controller could not be created.");
        }
Exemple #17
0
        private static void Main(string[] args)
        {
            string        uri                   = "http://*****:*****@"C:\temp\networkSpeedTo{0}.csv", uri.Replace(':', '-').Replace('/', '_'));

            // header
            timings.Add(string.Format("URI:, '{0}'", uri));
            timings.Add(string.Format("Max message size:, {0}, Initial block size:, {1}, Incrementing factor:, {2}, Rounds per packet size:, {3}", maxMessageSize, numberOfGuidsPerChunk, incrementingFactor, roundsPerPacketStep));

            using (var serverProxy = new ServerProxy(new Uri(uri)))
            {
                serverProxy.Connect(Guid.NewGuid());
                CommunicationControllerFactory cf = new CommunicationControllerFactory();
                while (sb.Length < maxMessageSize)
                {
                    timingsPerRound.Clear();
                    for (int i = 0; i < roundsPerPacketStep; i++)
                    {
                        var controller = cf.CreateController("TestNetworkService");
                        controller.AddPayloadArgument("payload", sb);
                        DateTime start = DateTime.Now;
                        // send very large message
                        var svc = controller.ExecuteCommand <ExecuteMessage>(serverProxy, Guid.NewGuid());

                        TimeSpan elapsed = DateTime.Now - start;
                        timingsPerRound.Add(elapsed.TotalMilliseconds);

                        // give the server time to clear it's queue
                        Thread.Sleep((int)Math.Round(elapsed.TotalMilliseconds) * 2);
                    }
                    string toAdd = string.Format("{0}, {1}", sb.Length, timingsPerRound.Sum() / roundsPerPacketStep);
                    Console.WriteLine(toAdd);
                    timings.Add(toAdd);
                    // build new packet that is incrementingFactor bigger than previous
                    StringBuilder tmpSb = new StringBuilder();
                    tmpSb.Append(sb);
                    Enumerable.Range(1, (int)Math.Ceiling(incrementingFactor)).ToList().ForEach(x =>
                                                                                                tmpSb.Append(tmpSb.ToString()));
                    sb.Append(tmpSb.ToString().Substring(0,
                                                         (int)((tmpSb.Length - sb.Length) * (incrementingFactor - 1))));
                }
            }
            File.WriteAllLines(outFileName, timings.ToArray());
            //Console.ReadKey();
        }
Exemple #18
0
        public IExplorerRepositoryResult RenameFolder(string path, string newName, Guid workSpaceId)
        {
            var controller = CommunicationControllerFactory.CreateController("RenameFolderService");

            controller.AddPayloadArgument("path", path);
            controller.AddPayloadArgument("newPath", newName);
            return(controller.ExecuteCommand <IExplorerRepositoryResult>(Connection, workSpaceId));
        }
Exemple #19
0
        public IExplorerRepositoryResult AddItem(IExplorerItem itemToAdd, Guid workSpaceId)
        {
            var controller = CommunicationControllerFactory.CreateController("AddFolderService");
            var serializer = new Dev2JsonSerializer();

            controller.AddPayloadArgument("itemToAdd", serializer.SerializeToBuilder(itemToAdd).ToString());
            return(controller.ExecuteCommand <IExplorerRepositoryResult>(Connection, workSpaceId));
        }
Exemple #20
0
        public IList <IPluginAction> PluginActionsWithReturns(IPluginSource source, INamespaceItem ns)
        {
            var serializer     = new Dev2JsonSerializer();
            var comsController = CommunicationControllerFactory.CreateController("FetchPluginActionsWithReturnsTypes");
            var pluginActions  = GetPluginActions(source, ns, comsController, serializer);

            return(pluginActions);
        }
Exemple #21
0
        public IExplorerItem GetLatestVersionNumber(Guid resourceId)
        {
            var workSpaceId = Guid.NewGuid();
            var controller  = CommunicationControllerFactory.CreateController("GetLatestVersionNumber");

            controller.AddPayloadArgument("resourceId", resourceId.ToString());
            return(controller.ExecuteCommand <IExplorerItem>(Connection, workSpaceId));
        }
        public async Task <IExplorerRepositoryResult> MoveItem(Guid sourceId, string destinationPath, string itemPath)
        {
            var controller = CommunicationControllerFactory.CreateController("MoveItemService");

            controller.AddPayloadArgument("itemToMove", sourceId.ToString());
            controller.AddPayloadArgument("newPath", destinationPath);
            controller.AddPayloadArgument("itemToBeRenamedPath", itemPath);
            return(await controller.ExecuteCommandAsync <IExplorerRepositoryResult>(Connection, GlobalConstants.ServerWorkspaceID).ConfigureAwait(true));
        }
Exemple #23
0
        public IList <IToolDescriptor> FetchTools()
        {
            var comsController = CommunicationControllerFactory.CreateController("FetchToolsService");

            var workspaceId = Connection.WorkspaceID;
            var result      = comsController.ExecuteCommand <IList <IToolDescriptor> >(Connection, workspaceId) ?? new List <IToolDescriptor>();

            return(result);
        }
        public string GetServerVersion()
        {
            var controller = CommunicationControllerFactory.CreateController("GetServerVersion");
            var version    = controller.ExecuteCommand <string>(Connection, Guid.Empty);

            if (String.IsNullOrEmpty(version))
            {
                return("less than 0.4.19.1");
            }
            return(version);
        }
Exemple #25
0
        ExecuteMessage FetchDependantsFromServerService(Guid resourceId, bool getDependsOnMe)
        {
            var comsController = CommunicationControllerFactory.CreateController("FindDependencyService");

            comsController.AddPayloadArgument("ResourceId", resourceId.ToString());
            comsController.AddPayloadArgument("GetDependsOnMe", getDependsOnMe.ToString());

            var payload = comsController.ExecuteCommand <ExecuteMessage>(Connection, GlobalConstants.ServerWorkspaceID);

            return(payload);
        }
        public void DeleteFolder(string path)
        {
            var controller = CommunicationControllerFactory.CreateController("DeleteItemService");

            controller.AddPayloadArgument("folderToDelete", path);
            var result = controller.ExecuteCommand <IExplorerRepositoryResult>(Connection, GlobalConstants.ServerWorkspaceID);

            if (result.Status != ExecStatus.Success)
            {
                throw new WarewolfSaveException(result.Message, null);
            }
        }
        public void DeleteResource(Guid id)
        {
            var controller = CommunicationControllerFactory.CreateController("DeleteItemService");

            controller.AddPayloadArgument("itemToDelete", id.ToString());
            var result = controller.ExecuteCommand <IExplorerRepositoryResult>(Connection, GlobalConstants.ServerWorkspaceID);

            if (result?.Status != ExecStatus.Success && result != null)
            {
                throw new WarewolfSaveException(result.Message, null);
            }
        }
Exemple #28
0
        public List <IDeployResult> Deploy(List <Guid> resourceIDsToDeploy, bool deployTests, IConnection destinationEnvironmentId)
        {
            var con            = Connection;
            var comsController = CommunicationControllerFactory.CreateController("DirectDeploy");
            var serialiser     = new Dev2JsonSerializer();

            comsController.AddPayloadArgument("resourceIDsToDeploy", serialiser.SerializeToBuilder(resourceIDsToDeploy));
            comsController.AddPayloadArgument("deployTests", new StringBuilder(deployTests.ToString()));
            comsController.AddPayloadArgument("destinationEnvironmentId", serialiser.SerializeToBuilder(destinationEnvironmentId));
            var output = comsController.ExecuteCommand <List <IDeployResult> >(con, GlobalConstants.ServerWorkspaceID);

            return(output);
        }
        public List <IWindowsGroupPermission> FetchPermissions()
        {
            if (!Connection.IsConnected)
            {
                ShowServerDisconnectedPopup();
                return(new List <IWindowsGroupPermission>());
            }

            var comsController = CommunicationControllerFactory.CreateController("FetchServerPermissions");
            var result         = comsController.ExecuteCommand <PermissionsModifiedMemo>(Connection, GlobalConstants.ServerWorkspaceID);

            return(result.ModifiedPermissions.Cast <IWindowsGroupPermission>().ToList());
        }
Exemple #30
0
        public void SaveWcfSource(IWcfServerSource wcfSource, Guid serverWorkspaceID)
        {
            var con            = Connection;
            var comsController = CommunicationControllerFactory.CreateController("SaveWcfServiceSource");
            var serialiser     = new Dev2JsonSerializer();

            comsController.AddPayloadArgument("WcfSource", serialiser.SerializeToBuilder(wcfSource));
            var output = comsController.ExecuteCommand <IExecuteMessage>(con, GlobalConstants.ServerWorkspaceID);

            if (output.HasError)
            {
                throw new WarewolfSaveException(output.Message.ToString(), null);
            }
        }