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); } }
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); }
public Task <List <string> > LoadDuplicates() { var comsController = CommunicationControllerFactory.CreateController("FetchResourceDuplicates"); var result = comsController.ExecuteCompressedCommandAsync <List <string> >(Connection, GlobalConstants.ServerWorkspaceID); return(result); }
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())); }
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)); }
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())); }
public IExplorerItem Load(ResourceType type, Guid workSpaceId) { var controller = CommunicationControllerFactory.CreateController("Management Services\\FetchExplorerItemsServiceByType"); return(controller.ExecuteCommand <IExplorerItem>(Connection, workSpaceId)); }
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); }
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)); }
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); }
/// <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); }
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); }
public string GetMinSupportedServerVersion() { var controller = CommunicationControllerFactory.CreateController("GetMinSupportedVersion"); var version = controller.ExecuteCommand <string>(Connection, Guid.Empty); return(version); }
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."); }
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(); }
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)); }
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)); }
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); }
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)); }
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); }
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); } }
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()); }
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); } }