private static JObject GetEnvironmentJObject(string serializedEnv) { var serializer = new Dev2JsonSerializer(); JObject jsonEnv = null; try { jsonEnv = serializer.Deserialize <JObject>(serializedEnv); } catch (JsonReaderException jre) { Dev2Logger.Error($"Error Deserializing Environment: {serializedEnv}", jre, GlobalConstants.WarewolfError); } return(jsonEnv); }
public XElement FetchXElementFromFixData() { if (!string.IsNullOrEmpty(_serviceDesignerViewModel.ValidationMemoManager.WorstDesignError?.FixData)) { try { return(XElement.Parse(_serviceDesignerViewModel.ValidationMemoManager.WorstDesignError.FixData)); } catch (Exception e) { Dev2Logger.Error(e, "Warewolf Error"); } } return(XElement.Parse("<x/>")); }
public override bool ExecuteOperation() { try { if (_impersonatedUser != null) { return(ExecuteOperationWithAuth()); } return(_deleteHelper.Delete(_path.Path)); } catch (Exception exception) { Dev2Logger.Error("Error getting file: " + _path.Path, exception, GlobalConstants.WarewolfError); return(false); } }
public override IOutputDescription TestService(DbService dbService) { VerifyArgument.IsNotNull("dbService", dbService); VerifyArgument.IsNotNull("dbService.Source", dbService.Source); IOutputDescription result; using (var server = CreateDbServer(dbService.Source as DbSource)) { server.Connect(((DbSource)dbService.Source).ConnectionString); server.BeginTransaction(); try { var command = CommandFromServiceMethod(server, dbService.Method); // ReSharper disable PossibleNullReferenceException var outParams = server.GetProcedureOutParams(command.CommandText); // ReSharper restore PossibleNullReferenceException foreach (var dbDataParameter in outParams) { if (command.Parameters.Contains(dbDataParameter)) { continue; } command.Parameters.Add(dbDataParameter); } var dataTable = server.FetchDataTable(command); result = OutputDescriptionFactory.CreateOutputDescription(OutputFormats.ShapedXML); var dataSourceShape = DataSourceShapeFactory.CreateDataSourceShape(); result.DataSourceShapes.Add(dataSourceShape); var dataBrowser = DataBrowserFactory.CreateDataBrowser(); dataSourceShape.Paths.AddRange(dataBrowser.Map(dataTable)); } catch (Exception ex) { Dev2Logger.Error(ex.Message); return(new OutputDescription()); } finally { server.RollbackTransaction(); } } return(result); }
public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace) { var msg = new ExecuteMessage(); var serializer = new Dev2JsonSerializer(); try { Dev2Logger.Info("Save Elasticsearch Resource Service", GlobalConstants.WarewolfInfo); values.TryGetValue(Warewolf.Service.SaveElasticsearchSource.ElasticsearchSource, out StringBuilder resourceDefinition); IElasticsearchSourceDefinition elasticsearchSourceDef = serializer.Deserialize <ElasticsearchSourceDefinition>(resourceDefinition); if (elasticsearchSourceDef.Path == null) { elasticsearchSourceDef.Path = string.Empty; } if (elasticsearchSourceDef.Path.EndsWith("\\")) { elasticsearchSourceDef.Path = elasticsearchSourceDef.Path.Substring(0, elasticsearchSourceDef.Path.LastIndexOf("\\", StringComparison.Ordinal)); } var elasticsearchSource = new ElasticsearchSource { ResourceID = elasticsearchSourceDef.Id, HostName = elasticsearchSourceDef.HostName, Port = elasticsearchSourceDef.Port, SearchIndex = elasticsearchSourceDef.SearchIndex, AuthenticationType = elasticsearchSourceDef.AuthenticationType, Password = elasticsearchSourceDef.Password, Username = elasticsearchSourceDef.Username, ResourceName = elasticsearchSourceDef.Name }; ResourceCat.SaveResource(GlobalConstants.ServerWorkspaceID, elasticsearchSource, elasticsearchSourceDef.Path); msg.HasError = false; } catch (Exception err) { msg.HasError = true; msg.Message = new StringBuilder(err.Message); Dev2Logger.Error(err, GlobalConstants.WarewolfError); } return(serializer.SerializeToBuilder(msg)); }
public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace) { Dev2Logger.Info("Fetch Debug Item File Started"); try { var result = new ExecuteMessage { HasError = false }; if (values == null) { Dev2Logger.Debug(ErrorResource.valuesAreMissing); throw new InvalidDataContractException(ErrorResource.valuesAreMissing); } StringBuilder tmp; values.TryGetValue("DebugItemFilePath", out tmp); if (tmp == null || tmp.Length == 0) { Dev2Logger.Debug("DebugItemFilePath is missing"); throw new InvalidDataContractException(string.Format(ErrorResource.PropertyMusHaveAValue, "DebugItemFilePath ")); } string debugItemFilePath = tmp.ToString(); if (File.Exists(debugItemFilePath)) { Dev2Logger.Debug("DebugItemFilePath found"); var lines = File.ReadLines(debugItemFilePath); foreach (var line in lines) { result.Message.AppendLine(line); } Dev2JsonSerializer serializer = new Dev2JsonSerializer(); return(serializer.SerializeToBuilder(result)); } Dev2Logger.Debug("DebugItemFilePath not found, throwing an exception"); throw new InvalidDataContractException(string.Format(string.Format(ErrorResource.NotFound, debugItemFilePath))); } catch (Exception e) { Dev2Logger.Error(e); throw; } }
public IEnumerable <FileResource> Build() { try { var fileResources = new List <FileResource>(); var filesList = _resourceHolder.GetFilesList(); foreach (var fileInfo in filesList) { var fileResource = new FileResource { ResourceName = fileInfo.Name, ResourcePath = fileInfo.FullName, ParentPath = fileInfo.DirectoryName, Children = new List <IFileResource>() }; var files = Directory.GetFiles(fileResource.ResourcePath); if (files.Any()) { foreach (var file in files) { fileResource.Children.Add(AddFileChildren(file, fileResource)); } } var directories = Directory.GetDirectories(fileResource.ResourcePath); if (directories.Any()) { foreach (var directory in directories) { fileResource.Children.Add(AddDirectoryChildren(directory, fileResource)); } } fileResources.Add(fileResource); } return(fileResources); } catch (Exception ex) when(ex is AccessViolationException) { Dev2Logger.Error(ex.Message, ex); throw; } catch (Exception ex) when(ex is IOException) { Dev2Logger.Error(ex.Message, ex); throw; } }
public override StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace) { try { var dependancyNames = new List <string>(); var dependsOnMe = false; var resourceIdsString = string.Empty; var dependsOnMeString = string.Empty; values.TryGetValue("ResourceIds", out StringBuilder tmp); if (tmp != null) { resourceIdsString = tmp.ToString(); } values.TryGetValue("GetDependsOnMe", out tmp); if (tmp != null) { dependsOnMeString = tmp.ToString(); } var resourceIds = JsonConvert.DeserializeObject <List <string> >(resourceIdsString).Select(Guid.Parse); Dev2Logger.Info("Get Dependencies On List. " + resourceIdsString, GlobalConstants.WarewolfInfo); if (!string.IsNullOrEmpty(dependsOnMeString) && !bool.TryParse(dependsOnMeString, out dependsOnMe)) { dependsOnMe = false; } if (dependsOnMe) { //TODO : other way } else { foreach (var resourceId in resourceIds) { dependancyNames.AddRange(FetchRecursiveDependancies(resourceId, theWorkspace.ID)); } } var serializer = new Dev2JsonSerializer(); return(serializer.SerializeToBuilder(dependancyNames)); } catch (Exception e) { Dev2Logger.Error(e, GlobalConstants.WarewolfError); throw; } }
public IDev2Activity Parse(DynamicActivity activity, Guid resourceIdGuid, bool failOnError) { if (HasActivityInCache(resourceIdGuid)) { var dev2Activity = GetActivity(resourceIdGuid); if (dev2Activity != null) { return(dev2Activity); } } var dynamicActivity = activity; if (dynamicActivity != null) { try { var act = _activityParser.Parse(dynamicActivity); if (Cache.TryAdd(resourceIdGuid, act)) { return(act); } Cache.AddOrUpdate(resourceIdGuid, act, (guid, dev2Activity) => { Cache[resourceIdGuid] = act; return(act); }); return(act); } catch (InvalidWorkflowException e) { Dev2Logger.Error($"Error processing {resourceIdGuid}: " + e.Message, "Warewolf Error"); if (failOnError) { throw; } } catch (Exception err) //errors caught inside { Dev2Logger.Error(err, "Warewolf Error"); if (failOnError) { throw; } } } return(null); }
public override void ProcessRequest(ICommunicationContext ctx) { var serviceName = ctx.GetServiceName(); var instanceId = ctx.GetInstanceID(); var bookmark = ctx.GetBookmark(); ctx.GetDataListID(); var workspaceId = ctx.GetWorkspaceID(); var formData = new WebRequestTO(); var xml = new SubmittedData().GetPostData(ctx); if (!string.IsNullOrEmpty(xml)) { formData.RawRequestPayload = xml; } formData.ServiceName = serviceName; formData.InstanceID = instanceId; formData.Bookmark = bookmark; formData.WebServerUrl = ctx.Request.Uri.ToString(); formData.Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}"; if (ExecutingUser == null) { throw new Exception(ErrorResource.NullExecutingUser); } try { // Execute in its own thread to give proper context var t = new Thread(() => { Thread.CurrentPrincipal = ExecutingUser; var responseWriter = CreateForm(formData, serviceName, workspaceId, ctx.FetchHeaders(), ctx.Request.User); ctx.Send(responseWriter); }); t.Start(); t.Join(); } catch (Exception e) { Dev2Logger.Error(this, e, GlobalConstants.WarewolfError); } }
public async Task <StringBuilder> ExecuteCommandAsync(StringBuilder payload, Guid workspaceId) { if (payload == null || payload.Length == 0) { throw new ArgumentNullException(nameof(payload)); } Dev2Logger.Debug("Execute Command Payload [ " + payload + " ]"); var messageId = Guid.NewGuid(); var envelope = new Envelope { PartID = 0, Type = typeof(Envelope), Content = payload.ToString() }; var result = new StringBuilder(); try { await EsbProxy.Invoke <Receipt>("ExecuteCommand", envelope, true, workspaceId, Guid.Empty, messageId); var fragmentInvoke = await EsbProxy.Invoke <string>("FetchExecutePayloadFragment", new FutureReceipt { PartID = 0, RequestID = messageId }).ConfigureAwait(false); result.Append(fragmentInvoke); if (result.Length > 0) { var start = result.LastIndexOf("<" + GlobalConstants.ManagementServicePayload + ">", false); if (start > 0) { var end = result.LastIndexOf("</" + GlobalConstants.ManagementServicePayload + ">", false); if (start < end && end - start > 1) { start += GlobalConstants.ManagementServicePayload.Length + 2; return(new StringBuilder(result.Substring(start, end - start))); } } } } catch (Exception e) { Dev2Logger.Error(e); } return(result); }
void Run(bool interactiveMode) { Tracker.StartServer(); // ** Perform Moq Installer Actions For Development ( DEBUG config ) ** #if DEBUG try { var miq = MoqInstallerActionFactory.CreateInstallerActions(); miq.ExecuteMoqInstallerActions(); } catch (Exception e) { Dev2Logger.Warn("Mocking installer actions for DEBUG config failed to create Warewolf Administrators group and/or to add current user to it [ " + e.Message + " ]", GlobalConstants.WarewolfWarn); } #endif try { SetWorkingDirectory(); LoadHostSecurityProvider(); MigrateOldTests(); InitializeServer(); LoadSettingsProvider(); ConfigureLoggging(); OpenCOMStream(); var catalog = LoadResourceCatalog(); _timer = new Timer(PerformTimerActions, null, 1000, GlobalConstants.NetworkComputerNameQueryFreq); StartPulseLogger(); LoadPerformanceCounters(); LoadServerWorkspace(); LoadActivityCache(catalog); StartWebServer(); LoadTestCatalog(); ServerLoop(interactiveMode); } catch (Exception e) { #pragma warning disable S2228 // Console logging should not be used #pragma warning disable S2228 // Console logging should not be used Console.WriteLine(e); #pragma warning restore S2228 // Console logging should not be used #pragma warning restore S2228 // Console logging should not be used Dev2Logger.Error("Error Starting Server", e, GlobalConstants.WarewolfError); Stop(true, 0); } }
Guid ExecuteWf() { var result = new Guid(); DataObject.StartTime = DateTime.Now; var wfappUtils = new WfApplicationUtils(); ErrorResultTO invokeErrors; try { IExecutionToken exeToken = new ExecutionToken { IsUserCanceled = false }; DataObject.ExecutionToken = exeToken; if (DataObject.IsDebugMode()) { wfappUtils.DispatchDebugState(DataObject, StateType.Start, DataObject.Environment.HasErrors(), DataObject.Environment.FetchErrors(), out invokeErrors, DataObject.StartTime, true, false, false); } if (CanExecute(DataObject.ResourceID, DataObject, AuthorizationContext.Execute)) { Eval(DataObject.ResourceID, DataObject); } if (DataObject.IsDebugMode()) { wfappUtils.DispatchDebugState(DataObject, StateType.End, DataObject.Environment.HasErrors(), DataObject.Environment.FetchErrors(), out invokeErrors, DataObject.StartTime, false, true); } result = DataObject.DataListID; } catch (InvalidWorkflowException iwe) { Dev2Logger.Error(iwe, DataObject.ExecutionID.ToString()); var msg = iwe.Message; var start = msg.IndexOf("Flowchart ", StringComparison.Ordinal); var errorMessage = start > 0 ? GlobalConstants.NoStartNodeError : iwe.Message; DataObject.Environment.AddError(errorMessage); wfappUtils.DispatchDebugState(DataObject, StateType.End, DataObject.Environment.HasErrors(), DataObject.Environment.FetchErrors(), out invokeErrors, DataObject.StartTime, false, true); } catch (Exception ex) { Dev2Logger.Error(ex, DataObject.ExecutionID.ToString()); DataObject.Environment.AddError(ex.Message); wfappUtils.DispatchDebugState(DataObject, StateType.End, DataObject.Environment.HasErrors(), DataObject.Environment.FetchErrors(), out invokeErrors, DataObject.StartTime, false, true); } return(result); }
public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace) { var msg = new ExecuteMessage(); var serializer = new Dev2JsonSerializer(); try { Dev2Logger.Info("Save Resource Service", GlobalConstants.WarewolfInfo); values.TryGetValue("ExchangeSource", out StringBuilder resourceDefinition); var src = serializer.Deserialize <ExchangeSourceDefinition>(resourceDefinition); var con = new ExchangeSource() { AutoDiscoverUrl = src.AutoDiscoverUrl, UserName = src.UserName, Password = src.Password, Timeout = src.Timeout, }; var testMessage = new ExchangeTestMessage() { Tos = new List <string> { src.EmailTo, }, CCs = new List <string> { string.Empty }, BcCs = new List <string> { string.Empty }, Subject = "Exchange Email Test", Body = "Test Exchange email service source", }; con.Send(new ExchangeEmailSender(con), testMessage); } catch (Exception err) { msg.HasError = true; msg.Message = new StringBuilder(err.Message); Dev2Logger.Error(err, GlobalConstants.WarewolfError); } return(serializer.SerializeToBuilder(msg)); }
public IList <IResourcePerformanceCounter> LoadOrCreateResourceCounters(string fileName) { try { var serialiser = new Dev2JsonSerializer(); if (!_file.Exists(fileName)) { return(DefaultResourceCounters); } return(serialiser.Deserialize <IList <IResourcePerformanceCounter> >(_file.ReadAllText(fileName))); } catch (Exception e) { Dev2Logger.Error(e); return(DefaultResourceCounters); } }
protected override void ExecuteTool(IDSFDataObject dataObject, int update) { IDev2MergeOperations mergeOperations = new Dev2MergeOperations(); var allErrors = new ErrorResultTO(); var errorResultTo = new ErrorResultTO(); InitializeDebug(dataObject); try { CleanArguments(MergeCollection); if (MergeCollection.Count <= 0) { return; } TryExecuteTool(dataObject, update, mergeOperations, allErrors, errorResultTo); } catch (Exception e) { Dev2Logger.Error("DSFDataMerge", e, GlobalConstants.WarewolfError); allErrors.AddError(e.Message); } finally { #region Handle Errors if (allErrors.HasErrors()) { if (dataObject.IsDebugMode()) { AddDebugOutputItem(new DebugItemStaticDataParams("", Result, "")); } DisplayAndWriteError("DsfDataMergeActivity", allErrors); var errorString = allErrors.MakeDisplayReady(); dataObject.Environment.AddError(errorString); } if (dataObject.IsDebugMode()) { DispatchDebugState(dataObject, StateType.Before, update); DispatchDebugState(dataObject, StateType.After, update); } #endregion } }
void TranslateDataTableToEnvironment(DataTable executeService, IExecutionEnvironment environment, int update) { var started = true; if (executeService != null && Outputs != null && Outputs.Count != 0 && executeService.Rows != null) { try { var rowIdx = 1; MapDataRowsToEnvironment(executeService, environment, update, ref started, ref rowIdx); } catch (Exception e) { Dev2Logger.Error(e, GlobalConstants.WarewolfError); } } }
public IList <IPerformanceCounter> LoadOrCreate(string fileName) { try { var serialiser = new Dev2JsonSerializer(); if (!_file.Exists(fileName)) { return(CreateDefaultPerfCounters()); } return(serialiser.Deserialize <IList <IPerformanceCounter> >(_file.ReadAllText(fileName))); } catch (Exception e) { Dev2Logger.Error(e, GlobalConstants.WarewolfError); return(CreateDefaultPerfCounters()); } }
/// <summary> /// Finds the first function in the collection that satisfies the expression passed in /// </summary> /// <param name="expression"></param> /// <returns></returns> public IFunction FindSingle(Expression <Func <IFunction, bool> > expression) { if (expression != null) { try { return(_functions.AsQueryable().First(expression)); } catch (InvalidOperationException ioex) { Dev2Logger.Error(ioex, GlobalConstants.WarewolfError); var func = MathOpsFactory.CreateFunction(); return(func); } } return(null); }
void ExecuteField(IDSFDataObject dataObject, int update, int innerCount, ActivityDTO t, ErrorResultTO allErrors) { var assignValue = new AssignValue(t.FieldName, t.FieldValue); var isCalcEvaluation = DataListUtil.IsCalcEvaluation(t.FieldValue, out string cleanExpression); if (isCalcEvaluation) { assignValue = new AssignValue(t.FieldName, cleanExpression); } DebugItem debugItem = null; if (dataObject.IsDebugMode()) { debugItem = TryCreateDebugInput(dataObject.Environment, innerCount, assignValue, update); } try { if (isCalcEvaluation) { DoCalculation(dataObject.Environment, t.FieldName, t.FieldValue, update); } else { dataObject.Environment.AssignWithFrame(assignValue, update); } } catch (Exception e) { Dev2Logger.Error(nameof(DsfMultiAssignActivity), e, GlobalConstants.WarewolfError); allErrors.AddError(e.Message); } if (debugItem != null) { _debugInputs.Add(debugItem); } if (dataObject.IsDebugMode()) { if (DataListUtil.IsValueRecordset(assignValue.Name) && DataListUtil.GetRecordsetIndexType(assignValue.Name) == enRecordsetIndexType.Blank) { var length = dataObject.Environment.GetLength(DataListUtil.ExtractRecordsetNameFromValue(assignValue.Name)); assignValue = new AssignValue(DataListUtil.ReplaceRecordsetBlankWithIndex(assignValue.Name, length), assignValue.Value); } AddSingleDebugOutputItem(dataObject.Environment, innerCount, assignValue, update); } }
public void Execute(IWebServerConfiguration webServerConfig, IPauseHelper pauseHelper) { if (webServerConfig.IsWebServerEnabled || webServerConfig.IsWebServerSslEnabled) { try { DoStartWebServer(webServerConfig); } catch (Exception e) { Dev2Logger.Error("Dev2.ServerLifecycleManager", e, GlobalConstants.WarewolfError); EnvironmentVariables.IsServerOnline = false; _writer.Fail("Webserver failed to start", e); pauseHelper.Pause(); } } }
private static bool TryParseAsDatetimeCompare(DateTime[] dtVal, int pos, bool isDateTimeCompare, string c) { try { if (DateTime.TryParse(c, out DateTime dt)) { dtVal[pos] = dt; isDateTimeCompare = true; } } catch (Exception ex) { Dev2Logger.Error(ex, GlobalConstants.WarewolfError); } return(isDateTimeCompare); }
public override bool ExecuteOperationWithAuth() { using (_impersonatedUser) { try { return(PathIs(_path, _fileWrapper, _dirWrapper) == enPathType.Directory ? _dirWrapper.Exists(_path.Path) : _fileWrapper.Exists(_path.Path)); } catch (Exception ex) { Dev2Logger.Error(ex.Message, GlobalConstants.Warewolf); return(false); } } }
private static bool CreateCustomFunction(string functionName, Func <double[], double> func, out CustomCalculationFunction custCalculation) { bool isSucessfullyCreated; try { custCalculation = new CustomCalculationFunction(functionName, func, 0, 1); isSucessfullyCreated = true; } catch (Exception ex) { Dev2Logger.Error("Function", ex); custCalculation = null; isSucessfullyCreated = false; } return(isSucessfullyCreated); }
static void SetAsStarted() { try { var studioFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var studioStartedFile = Path.Combine(studioFolder, "StudioStarted"); if (File.Exists(studioStartedFile)) { File.Delete(studioStartedFile); } File.WriteAllText(studioStartedFile, DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture)); } catch (Exception err) { Dev2Logger.Error(err, GlobalConstants.WarewolfError); } }
static void WritePerfCounterSettings(IWorkspace theWorkspace, Settings settings, ExecuteMessage result) { try { if (settings.Logging != null) { var executionResult = ExecuteService(theWorkspace, new SavePerformanceCounters(), "PerformanceCounterTo", settings.PerfCounters); result.Message.AppendLine(executionResult); } } catch (Exception ex) { Dev2Logger.Error(ErrorResource.ErrorWritingLoggingConfiguration, ex, GlobalConstants.WarewolfError); result.HasError = true; result.Message.AppendLine(ErrorResource.ErrorWritingLoggingConfiguration); } }
public List <ToolConflictRow> CreateList(ConflictRowList list, ConflictTreeNode[] currentTree, ConflictTreeNode[] diffTree) { var _currentTree = currentTree; var _diffTree = diffTree; _list = list; var toolConflictRowList = new List <ToolConflictRow>(); indexDiff = 0; indexCurr = 0; for (int i = 0; i <= MAX_WORKFLOW_ITEMS; i++) { if (i == MAX_WORKFLOW_ITEMS) { Dev2Logger.Error("ConflictRowListBuilder.CreateList: createlist expected to advance", GlobalConstants.WarewolfError); throw new Exception("createlist expected to advance"); } ConflictTreeNode current = null; ConflictTreeNode diff = null; current = GetConflictTreeNode(true, indexCurr, indexDiff, _currentTree); diff = GetConflictTreeNode(false, indexCurr, indexDiff, _diffTree); if (current == null && diff == null) { break; } currentToolConflictItem = null; diffToolConflictItem = null; bool diffFoundInCurrent = _currentTree.Contains(diff); bool currFoundInDifferent = _diffTree.Contains(current); if (diffFoundInCurrent && currFoundInDifferent) { diff = _diffTree.FirstOrDefault(o => o.UniqueId == current.UniqueId); current = _currentTree.FirstOrDefault(o => o.UniqueId == current.UniqueId); } GetToolConflictItems(current, diff, diffFoundInCurrent, currFoundInDifferent); var toolConflictRow = BuildToolConflictRow(list, current, diff); toolConflictRow.IsMergeVisible = toolConflictRow.HasConflict; toolConflictRowList.Add(toolConflictRow); } return(toolConflictRowList); }
static void WriteSecuritySettings(IWorkspace theWorkspace, Settings settings, ExecuteMessage result) { try { if (settings.Security != null) { var executionResult = ExecuteService(theWorkspace, new SecurityWrite(), "SecuritySettings", settings.Security); result.Message.AppendLine(executionResult); } } catch (Exception ex) { Dev2Logger.Error(ErrorResource.ErrorWritingSettingsConfiguration, ex, GlobalConstants.WarewolfError); result.HasError = true; result.Message.AppendLine(ErrorResource.ErrorWritingSettingsConfiguration); } }
public IList <IActivityIOPath> ListFilesInDirectory(IActivityIOPath src) { List <string> dirs; try { var tmpDirData = _implementation.ExtendedDirList(src.Path, src.Username, src.Password, _implementation.EnableSsl(src), src.IsNotCertVerifiable, src.PrivateKeyFile); dirs = _implementation.ExtractList(tmpDirData, IsFile); } catch (Exception ex) { Dev2Logger.Error(this, ex, GlobalConstants.WarewolfError); var message = $"{ex.Message} : [{src.Path}]"; throw new Exception(message, ex); } return(dirs.Select(dir => _implementation.BuildValidPathForFtp(src, dir)).Select(uri => ActivityIOFactory.CreatePathFromString(uri, src.Username, src.Password, src.PrivateKeyFile)).ToList()); }
public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace) { IExplorerRepositoryResult item = null; var serializer = new Dev2JsonSerializer(); try { if (values == null) { throw new ArgumentNullException(nameof(values)); } StringBuilder itemBeingDeleted; StringBuilder pathBeingDeleted = null; if (!values.TryGetValue("itemToDelete", out itemBeingDeleted)) { if (!values.TryGetValue("folderToDelete", out pathBeingDeleted)) { throw new ArgumentException(string.Format(ErrorResource.IsBlank, "itemToDelete")); } } IExplorerItem itemToDelete; if (itemBeingDeleted != null) { itemToDelete = ServerExplorerRepo.Find(a => a.ResourceId.ToString() == itemBeingDeleted.ToString()); Dev2Logger.Info("Delete Item Service." + itemToDelete); item = ServerExplorerRepo.DeleteItem(itemToDelete, GlobalConstants.ServerWorkspaceID); } else if (pathBeingDeleted != null) { itemToDelete = new ServerExplorerItem { ResourceType = "Folder", ResourcePath = pathBeingDeleted.ToString() }; item = ServerExplorerRepo.DeleteItem(itemToDelete, GlobalConstants.ServerWorkspaceID); } } catch (Exception e) { Dev2Logger.Error("Delete Item Error", e); item = new ExplorerRepositoryResult(ExecStatus.Fail, e.Message); } return(serializer.SerializeToBuilder(item)); }