コード例 #1
0
        public override void UpdateForEachInputs(IList <Tuple <string, string> > updates)
        {
            foreach (Tuple <string, string> t in updates)
            {
                if (t.Item1 == ArchivePassword)
                {
                    ArchivePassword = t.Item2;
                }

                if (t.Item1 == Overwrite.ToString())
                {
                    bool tmpOverwrite;
                    bool.TryParse(t.Item2, out tmpOverwrite);
                    Overwrite = tmpOverwrite;
                }

                if (t.Item1 == InputPath)
                {
                    InputPath = t.Item2;
                }

                if (t.Item1 == OutputPath)
                {
                    OutputPath = t.Item2;
                }
            }
        }
コード例 #2
0
 public override IEnumerable <StateVariable> GetState()
 {
     return(new[]
     {
         new StateVariable
         {
             Name = "ServerInputPathFrom",
             Type = StateVariable.StateType.Input,
             Value = ServerInputPathFrom
         },
         new StateVariable
         {
             Name = "ServerInputPathTo",
             Type = StateVariable.StateType.Input,
             Value = ServerInputPathTo
         },
         new StateVariable
         {
             Name = "Overwrite",
             Type = StateVariable.StateType.Input,
             Value = Overwrite.ToString()
         },
         new StateVariable
         {
             Name = "Result",
             Type = StateVariable.StateType.Output,
             Value = Result
         }
     });
 }
コード例 #3
0
        /// <summary>
        /// Get the parameters as a FormParameter array
        /// </summary>
        /// <returns></returns>
        public override FormParameter[] Parameters()
        {
            var parameters = new List <FormParameter>
            {
                new FormParameter("path", DestinationPath),
                new FormParameter("create_parents", CreateParents),
                new FormParameter("overwrite", Overwrite.HasValue ? Overwrite.ToString().ToLowerInvariant() : "(None)"),
            };

            if (LastModifiedTime.HasValue)
            {
                parameters.Add(new FormParameter("mtime", LastModifiedTime.Value));
            }

            if (CreatedTime.HasValue)
            {
                parameters.Add(new FormParameter("crtime", CreatedTime.Value));
            }

            if (CreatedTime.HasValue)
            {
                parameters.Add(new FormParameter("atime", LastAccessTime.Value));
            }

            parameters.Add(new FormParameter("size", FileData.Length));

            // From the documentation, the file must always be the last parameter
            parameters.Add(new FileFormDataParameter("file", FileName, FileData));

            return(parameters.ToArray());
        }
コード例 #4
0
 public override IEnumerable <StateVariable> GetState()
 {
     return(new[] {
         new StateVariable
         {
             Name = nameof(OutputPath),
             Value = OutputPath,
             Type = StateVariable.StateType.Output
         },
         new StateVariable
         {
             Name = nameof(Overwrite),
             Value = Overwrite.ToString(),
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(AppendTop),
             Value = AppendTop.ToString(),
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(AppendBottom),
             Value = AppendBottom.ToString(),
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(FileContents),
             Value = FileContents,
             Type = StateVariable.StateType.InputOutput
         },
         new StateVariable
         {
             Name = nameof(FileContentsAsBase64),
             Value = FileContentsAsBase64.ToString(),
             Type = StateVariable.StateType.InputOutput
         },
         new StateVariable
         {
             Name = nameof(Username),
             Value = Username,
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(PrivateKeyFile),
             Value = PrivateKeyFile,
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(Result),
             Value = Result,
             Type = StateVariable.StateType.Output
         }
     });
 }
コード例 #5
0
ファイル: DsfPathCreate.cs プロジェクト: kapiya/Warewolf
        protected override IList <OutputTO> TryExecuteConcreteAction(IDSFDataObject context, out ErrorResultTO error, int update)
        {
            IList <OutputTO> outputs = new List <OutputTO>();

            error = new ErrorResultTO();
            var colItr = new WarewolfListIterator();

            //get all the possible paths for all the string variables

            var outputItr = new WarewolfIterator(context.Environment.Eval(OutputPath, update));

            colItr.AddVariableToIterateOn(outputItr);

            var passItr = new WarewolfIterator(context.Environment.Eval(DecryptedPassword, update));

            colItr.AddVariableToIterateOn(passItr);

            var privateKeyItr = new WarewolfIterator(context.Environment.Eval(PrivateKeyFile, update));

            colItr.AddVariableToIterateOn(privateKeyItr);

            if (context.IsDebugMode())
            {
                AddDebugInputItem(new DebugEvalResult(OutputPath, "File or Folder", context.Environment, update));
                AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
                AddDebugInputItemUserNamePassword(context.Environment, update);
                if (!string.IsNullOrEmpty(PrivateKeyFile))
                {
                    AddDebugInputItem(PrivateKeyFile, "Destination Private Key File", context.Environment, update);
                }
            }

            while (colItr.HasMoreData())
            {
                var broker = ActivityIOFactory.CreateOperationsBroker();
                var opTo   = new Dev2CRUDOperationTO(Overwrite);

                try
                {
                    var dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(outputItr),
                                                                     Username,
                                                                     colItr.FetchNextValue(passItr),
                                                                     true, colItr.FetchNextValue(privateKeyItr));
                    var dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
                    var result      = broker.Create(dstEndPoint, opTo, true);
                    outputs.Add(DataListFactory.CreateOutputTO(Result, result));
                }
                catch (Exception e)
                {
                    outputs.Add(DataListFactory.CreateOutputTO(Result, "Failure"));
                    error.AddError(e.Message);
                    break;
                }
            }

            return(outputs);
        }
コード例 #6
0
ファイル: DsfPathCreate.cs プロジェクト: ndubul/Chillas
        protected override IList <OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update)
        {
            IList <OutputTO> outputs = new List <OutputTO>();

            allErrors = new ErrorResultTO();
            var colItr = new WarewolfListIterator();

            //get all the possible paths for all the string variables

            var outputItr = new WarewolfIterator(dataObject.Environment.Eval(OutputPath, update));

            colItr.AddVariableToIterateOn(outputItr);

            var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update));

            colItr.AddVariableToIterateOn(unameItr);

            var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword, update));

            colItr.AddVariableToIterateOn(passItr);

            if (dataObject.IsDebugMode())
            {
                AddDebugInputItem(new DebugEvalResult(OutputPath, "File or Folder", dataObject.Environment, update));
                AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
                AddDebugInputItemUserNamePassword(dataObject.Environment, update);
            }

            while (colItr.HasMoreData())
            {
                IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();
                Dev2CRUDOperationTO       opTo   = new Dev2CRUDOperationTO(Overwrite);

                try
                {
                    IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(outputItr),
                                                                                 colItr.FetchNextValue(unameItr),
                                                                                 colItr.FetchNextValue(passItr),
                                                                                 true);

                    IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
                    string result = broker.Create(dstEndPoint, opTo, true);
                    outputs.Add(DataListFactory.CreateOutputTO(Result, result));
                }
                catch (Exception e)
                {
                    outputs.Add(DataListFactory.CreateOutputTO(Result, "Failure"));
                    allErrors.AddError(e.Message);
                    break;
                }
            }

            return(outputs);
        }
コード例 #7
0
ファイル: DsfUnZip.cs プロジェクト: pyrodc/Warewolf
 public override IEnumerable <StateVariable> GetState()
 {
     return(new[] {
         new StateVariable
         {
             Name = nameof(InputPath),
             Value = InputPath,
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(Username),
             Value = Username,
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(PrivateKeyFile),
             Value = PrivateKeyFile,
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(OutputPath),
             Value = OutputPath,
             Type = StateVariable.StateType.Output
         },
         new StateVariable
         {
             Name = nameof(DestinationUsername),
             Value = DestinationUsername,
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(DestinationPrivateKeyFile),
             Value = DestinationPrivateKeyFile,
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(Overwrite),
             Value = Overwrite.ToString(),
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = nameof(Result),
             Value = Result,
             Type = StateVariable.StateType.Output
         }
     });
 }
コード例 #8
0
 public override IEnumerable <StateVariable> GetState()
 {
     return(new[] {
         new StateVariable
         {
             Name = "InputPath",
             Type = StateVariable.StateType.Input,
             Value = InputPath
         },
         new StateVariable
         {
             Name = "Username",
             Type = StateVariable.StateType.Input,
             Value = Username
         },
         new StateVariable
         {
             Name = "PrivateKeyFile",
             Type = StateVariable.StateType.Input,
             Value = PrivateKeyFile
         },
         new StateVariable
         {
             Name = "OutputPath",
             Type = StateVariable.StateType.Output,
             Value = OutputPath
         },
         new StateVariable
         {
             Name = "DestinationUsername",
             Type = StateVariable.StateType.Input,
             Value = DestinationUsername
         },
         new StateVariable
         {
             Name = "DestinationPrivateKeyFile",
             Type = StateVariable.StateType.Input,
             Value = DestinationPrivateKeyFile
         },
         new StateVariable
         {
             Name = "Overwrite",
             Type = StateVariable.StateType.Input,
             Value = Overwrite.ToString()
         },
         new StateVariable
         {
             Name = "Result",
             Type = StateVariable.StateType.Output,
             Value = Result
         }
     });
 }
コード例 #9
0
        /// <summary>
        /// Transmits a block of data
        /// </summary>
        /// <param name="startIndex">Start index within the byte array</param>
        /// <param name="count">The number of bytes to send</param>
        /// <param name="final">Indicates whether this is the final packet</param>
        private void Transmit(long startIndex, long count, bool final)
        {
            string content = string.Empty;
            string mode    = "new";
            string url     = WebserviceURL + "/" + WebserviceMethod;
            Comms  helper  = null;

            if (_current.DataStream != null)
            {
                byte[] buffer = new byte[count];

                _current.DataStream.Read(buffer, 0, (int)count);
                content = Convert.ToBase64String(buffer);
            }
            else
            {
                content = Convert.ToBase64String(_current.Data, (int)startIndex, (int)count);
            }

            if (startIndex > 0)
            {
                mode = "append";
            }

            if (_current.TargetFileName.Length > 0)
            {
                helper = new Comms(new Uri(url), "POST", false,
                                   new KeyValuePair <string, string>("id", HttpUtility.UrlEncode(_current.ID)),
                                   new KeyValuePair <string, string>("mode", HttpUtility.UrlEncode(mode)),
                                   new KeyValuePair <string, string>("path", HttpUtility.UrlEncode(_current.TargetPath)),
                                   new KeyValuePair <string, string>("name", HttpUtility.UrlEncode(_current.FileName)),
                                   new KeyValuePair <string, string>("targetname", HttpUtility.UrlEncode(_current.TargetFileName)),
                                   new KeyValuePair <string, string>("filedata", HttpUtility.UrlEncode(content)),
                                   new KeyValuePair <string, string>("overwrite", Overwrite.ToString()),
                                   new KeyValuePair <string, string>("tag", HttpUtility.UrlEncode(_current.Tag)),
                                   new KeyValuePair <string, string>("final", final.ToString()));
            }
            else
            {
                helper = new Comms(new Uri(url), "POST", false,
                                   new KeyValuePair <string, string>("id", HttpUtility.UrlEncode(_current.ID)),
                                   new KeyValuePair <string, string>("mode", HttpUtility.UrlEncode(mode)),
                                   new KeyValuePair <string, string>("path", HttpUtility.UrlEncode(_current.TargetPath)),
                                   new KeyValuePair <string, string>("name", HttpUtility.UrlEncode(_current.FileName)),
                                   new KeyValuePair <string, string>("filedata", HttpUtility.UrlEncode(content)),
                                   new KeyValuePair <string, string>("overwrite", Overwrite.ToString()),
                                   new KeyValuePair <string, string>("tag", HttpUtility.UrlEncode(_current.Tag)),
                                   new KeyValuePair <string, string>("final", final.ToString()));
            }
            helper.ResponseComplete += new HttpResponseCompleteEventHandler(this.CommandComplete);
            helper.Execute();
        }
コード例 #10
0
        public override void Install()
        {
            Console.WriteLine("");
            Console.WriteLine("Installing csAnt...");
            Console.WriteLine("");
            Console.WriteLine("Destination:");
            Console.WriteLine("  " + DestinationPath);
            Console.WriteLine("");
            Console.WriteLine("Clear: " + Clear.ToString());
            Console.WriteLine("Overwrite: " + Overwrite.ToString());
            Console.WriteLine("");
            Console.WriteLine("Clone: " + Clone.ToString());
            Console.WriteLine("Clone source:");
            Console.WriteLine("  " + CloneSource);
            Console.WriteLine("");
            Console.WriteLine("Import: " + Import.ToString());
            Console.WriteLine("Import path: ");
            Console.WriteLine("  " + ImportPath);

            if (Clear)
            {
                ClearFiles();
            }

            Retriever.Retrieve(PackageName, Version, Status);

            Unpacker.Unpack(
                DestinationPath, // TODO: Make this configurable
                PackageName,
                Version,
                Overwrite
                );

            if (Import)
            {
                ImportFiles();
            }

            if (Clone)
            {
                CloneFiles();
            }

            EnsureNode();

            RaiseInstallEvent();
        }
コード例 #11
0
        public List <KeyValuePair <string, string> > ToKeyValuePairs()
        {
            var result = new List <KeyValuePair <string, string> >(10);

            // leave out null values, but string.Empty is preserved
            if (FileName != null)
            {
                result.Add("FileName", FileName);
            }

            if (ContentId > 0)
            {
                result.Add("ContentId", ContentId.ToString());
            }

            if (ContentType != null)
            {
                result.Add("ContentType", ContentType);
            }
            if (PropertyName != null)
            {
                result.Add("PropertyName", PropertyName);
            }

            result.Add("UseChunk", UseChunk.ToString());
            result.Add("Overwrite", Overwrite.ToString());
            result.Add("FileLength", FileLength.ToString());

            if (ChunkToken != null)
            {
                result.Add("ChunkToken", ChunkToken);
            }

            if (FileText != null)
            {
                result.Add("FileText", FileText);
            }

            return(result);
        }
コード例 #12
0
 public override IList <DsfForEachItem> GetForEachInputs()
 {
     return(GetForEachItems(ArchivePassword, Overwrite.ToString(), OutputPath, InputPath));
 }
コード例 #13
0
        public void DsfPathMove_GetState_ReturnsStateVariable()
        {
            //---------------Set up test pack-------------------
            //------------Setup for test--------------------------
            var act = new DsfPathMove
            {
                InputPath                 = "[[InputPath]]",
                Username                  = "******",
                PrivateKeyFile            = "abcde",
                OutputPath                = "[[OutputPath]]",
                DestinationUsername       = "******",
                DestinationPrivateKeyFile = "fghij",
                Result = "[[res]]"
            };
            //------------Execute Test---------------------------
            var stateItems = act.GetState();

            Assert.AreEqual(8, stateItems.Count());

            var expectedResults = new[]
            {
                new StateVariable
                {
                    Name  = "InputPath",
                    Type  = StateVariable.StateType.Input,
                    Value = "[[InputPath]]"
                },
                new StateVariable
                {
                    Name  = "Username",
                    Type  = StateVariable.StateType.Input,
                    Value = "Bob"
                },
                new StateVariable
                {
                    Name  = "PrivateKeyFile",
                    Type  = StateVariable.StateType.Input,
                    Value = "abcde"
                },
                new StateVariable
                {
                    Name  = "OutputPath",
                    Type  = StateVariable.StateType.Output,
                    Value = "[[OutputPath]]"
                },
                new StateVariable
                {
                    Name  = "DestinationUsername",
                    Type  = StateVariable.StateType.Input,
                    Value = "John"
                },
                new StateVariable
                {
                    Name  = "DestinationPrivateKeyFile",
                    Type  = StateVariable.StateType.Input,
                    Value = "fghij"
                },
                new StateVariable
                {
                    Name  = nameof(Overwrite),
                    Type  = StateVariable.StateType.Input,
                    Value = Overwrite.ToString()
                },
                new StateVariable
                {
                    Name  = "Result",
                    Type  = StateVariable.StateType.Output,
                    Value = "[[res]]"
                }
            };

            var iter = act.GetState().Select(
                (item, index) => new
            {
                value       = item,
                expectValue = expectedResults[index]
            }
                );

            //------------Assert Results-------------------------
            foreach (var entry in iter)
            {
                Assert.AreEqual(entry.expectValue.Name, entry.value.Name);
                Assert.AreEqual(entry.expectValue.Type, entry.value.Type);
                Assert.AreEqual(entry.expectValue.Value, entry.value.Value);
            }
        }
コード例 #14
0
        protected override IList <OutputTO> ExecuteConcreteAction(NativeActivityContext context,
                                                                  out ErrorResultTO allErrors)
        {
            IList <OutputTO>  outputs    = new List <OutputTO>();
            IDSFDataObject    dataObject = context.GetExtension <IDSFDataObject>();
            IDataListCompiler compiler   = DataListFactory.CreateDataListCompiler();

            allErrors = new ErrorResultTO();
            ErrorResultTO errors;
            Guid          executionId = dataObject.DataListID;

            ColItr = Dev2ValueObjectFactory.CreateIteratorCollection();

            //get all the possible paths for all the string variables
            IBinaryDataListEntry inputPathEntry = compiler.Evaluate(executionId, enActionType.User, InputPath, false,
                                                                    out errors);

            allErrors.MergeErrors(errors);
            IDev2DataListEvaluateIterator inputItr = Dev2ValueObjectFactory.CreateEvaluateIterator(inputPathEntry);

            ColItr.AddIterator(inputItr);

            IBinaryDataListEntry outputPathEntry = compiler.Evaluate(executionId, enActionType.User, OutputPath, false,
                                                                     out errors);

            allErrors.MergeErrors(errors);
            IDev2DataListEvaluateIterator outputItr = Dev2ValueObjectFactory.CreateEvaluateIterator(outputPathEntry);

            ColItr.AddIterator(outputItr);

            IBinaryDataListEntry usernameEntry = compiler.Evaluate(executionId, enActionType.User, Username, false,
                                                                   out errors);

            allErrors.MergeErrors(errors);
            IDev2DataListEvaluateIterator unameItr = Dev2ValueObjectFactory.CreateEvaluateIterator(usernameEntry);

            ColItr.AddIterator(unameItr);

            IBinaryDataListEntry passwordEntry = compiler.Evaluate(executionId, enActionType.User, Password, false,
                                                                   out errors);

            allErrors.MergeErrors(errors);
            IDev2DataListEvaluateIterator passItr = Dev2ValueObjectFactory.CreateEvaluateIterator(passwordEntry);

            ColItr.AddIterator(passItr);

            IBinaryDataListEntry destinationUsernameEntry = compiler.Evaluate(executionId, enActionType.User, DestinationUsername, false,
                                                                              out errors);

            allErrors.MergeErrors(errors);
            IDev2DataListEvaluateIterator desunameItr = Dev2ValueObjectFactory.CreateEvaluateIterator(destinationUsernameEntry);

            ColItr.AddIterator(desunameItr);

            IBinaryDataListEntry destinationPasswordEntry = compiler.Evaluate(executionId, enActionType.User, DestinationPassword, false,
                                                                              out errors);

            allErrors.MergeErrors(errors);
            IDev2DataListEvaluateIterator despassItr = Dev2ValueObjectFactory.CreateEvaluateIterator(destinationPasswordEntry);

            ColItr.AddIterator(despassItr);

            var iteratorsErrors = new List <ErrorResultTO>();

            AddItemsToIterator(executionId, compiler, iteratorsErrors);
            ErrorResultTO to = allErrors;

            iteratorsErrors.ForEach(to.MergeErrors);

            outputs.Add(DataListFactory.CreateOutputTO(Result));

            if (dataObject.IsDebugMode())
            {
                AddDebugInputItem(new DebugItemVariableParams(InputPath, "Source Path", inputPathEntry, executionId));
                AddDebugInputItemUserNamePassword(executionId, usernameEntry);
                AddDebugInputItem(new DebugItemVariableParams(OutputPath, "Destination Path", outputPathEntry, executionId));
                AddDebugInputItemDestinationUsernamePassword(executionId, destinationUsernameEntry, DestinationPassword, DestinationUsername);
                AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
                AddDebugInputItems(executionId);
            }

            while (ColItr.HasMoreData())
            {
                var             hasError = false;
                IActivityIOPath src      = null;
                IActivityIOPath dst      = null;
                try
                {
                    src = ActivityIOFactory.CreatePathFromString(ColItr.FetchNextRow(inputItr).TheValue,
                                                                 ColItr.FetchNextRow(unameItr).TheValue,
                                                                 ColItr.FetchNextRow(passItr).TheValue,
                                                                 true);
                }
                catch (IOException ioException)
                {
                    allErrors.AddError("Source: " + ioException.Message);
                    hasError = true;
                }
                try
                {
                    dst = ActivityIOFactory.CreatePathFromString(ColItr.FetchNextRow(outputItr).TheValue,
                                                                 ColItr.FetchNextRow(desunameItr).TheValue,
                                                                 ColItr.FetchNextRow(despassItr).TheValue,
                                                                 true);
                }
                catch (IOException ioException)
                {
                    allErrors.AddError("Destination:" + ioException.Message);
                    hasError = true;
                }

                if (hasError)
                {
                    outputs[0].OutputStrings.Add(null);
                    MoveRemainingIterators();
                    continue;
                }
                IActivityIOOperationsEndPoint scrEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(src);
                IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);

                try
                {
                    IActivityOperationsBroker broker = GetOperationBroker();
                    var result = ExecuteBroker(broker, scrEndPoint, dstEndPoint);
                    outputs[0].OutputStrings.Add(result);
                }
                catch (Exception e)
                {
                    allErrors.AddError(e.Message);
                    outputs[0].OutputStrings.Add(null);
                }
            }

            return(outputs);
        }
コード例 #15
0
        protected override IList <OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update)
        {
            IList <OutputTO> outputs = new List <OutputTO>();

            allErrors = new ErrorResultTO();
            ColItr    = new WarewolfListIterator();

            //get all the possible paths for all the string variables
            var inputItr = new WarewolfIterator(dataObject.Environment.Eval(InputPath, update));

            ColItr.AddVariableToIterateOn(inputItr);


            var outputItr = new WarewolfIterator(dataObject.Environment.Eval(OutputPath, update));

            ColItr.AddVariableToIterateOn(outputItr);


            var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update));

            ColItr.AddVariableToIterateOn(unameItr);


            var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword, update));

            ColItr.AddVariableToIterateOn(passItr);


            var desunameItr = new WarewolfIterator(dataObject.Environment.Eval(DestinationUsername, update));

            ColItr.AddVariableToIterateOn(desunameItr);


            var despassItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedDestinationPassword, update));

            ColItr.AddVariableToIterateOn(despassItr);

            AddItemsToIterator(dataObject.Environment, update);

            outputs.Add(DataListFactory.CreateOutputTO(Result));

            if (dataObject.IsDebugMode())
            {
                AddDebugInputItem(new DebugEvalResult(InputPath, "Source Path", dataObject.Environment, update));
                AddDebugInputItemUserNamePassword(dataObject.Environment, update);
                AddDebugInputItem(new DebugEvalResult(OutputPath, "Destination Path", dataObject.Environment, update));
                AddDebugInputItemDestinationUsernamePassword(dataObject.Environment, DestinationPassword, DestinationUsername, update);
                AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
                AddDebugInputItems(dataObject.Environment, update);
            }

            while (ColItr.HasMoreData())
            {
                var             hasError = false;
                IActivityIOPath src      = null;
                IActivityIOPath dst      = null;
                try
                {
                    src = ActivityIOFactory.CreatePathFromString(ColItr.FetchNextValue(inputItr),
                                                                 ColItr.FetchNextValue(unameItr),
                                                                 ColItr.FetchNextValue(passItr),
                                                                 true);
                }
                catch (IOException ioException)
                {
                    allErrors.AddError("Source: " + ioException.Message);
                    hasError = true;
                }
                try
                {
                    dst = ActivityIOFactory.CreatePathFromString(ColItr.FetchNextValue(outputItr),
                                                                 ColItr.FetchNextValue(desunameItr),
                                                                 ColItr.FetchNextValue(despassItr),
                                                                 true);
                }
                catch (IOException ioException)
                {
                    allErrors.AddError("Destination:" + ioException.Message);
                    hasError = true;
                }

                if (hasError)
                {
                    outputs[0].OutputStrings.Add(null);
                    MoveRemainingIterators();
                    continue;
                }
                IActivityIOOperationsEndPoint scrEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(src);
                IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);

                try
                {
                    IActivityOperationsBroker broker = GetOperationBroker();
                    var result = ExecuteBroker(broker, scrEndPoint, dstEndPoint);
                    outputs[0].OutputStrings.Add(result);
                }
                catch (Exception e)
                {
                    allErrors.AddError(e.Message);
                    outputs[0].OutputStrings.Add(null);
                }
            }

            return(outputs);
        }
コード例 #16
0
        internal int OnExecute(IConsole console, CommandLineApplication app)
        {
            _logger.LogInformation(LoggingEvents.ParameterEvent, "Settings: {Settings}, Target: {Target}, Overwrite: {Overwrite}, Verbose: {Verbose}", Settings, Target, Overwrite.ToString(), Verbose.ToString());

            console.WriteLine();
            console.WriteLine("You need to specify a command.");
            console.WriteLine();

            app.ShowHelp();

            _logger.LogInformation(LoggingEvents.CompleteEvent, "Modeller Complete");
            return(1);
        }
コード例 #17
0
        protected override IList <OutputTO> ExecuteConcreteAction(NativeActivityContext context, out ErrorResultTO allErrors)
        {
            IList <OutputTO> outputs    = new List <OutputTO>();
            IDSFDataObject   dataObject = context.GetExtension <IDSFDataObject>();

            IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();

            allErrors = new ErrorResultTO();
            ErrorResultTO           errors;
            Guid                    executionId = dataObject.DataListID;
            IDev2IteratorCollection colItr      = Dev2ValueObjectFactory.CreateIteratorCollection();

            //get all the possible paths for all the string variables
            IBinaryDataListEntry outputPathEntry = compiler.Evaluate(executionId, enActionType.User, OutputPath, false, out errors);

            allErrors.MergeErrors(errors);
            IDev2DataListEvaluateIterator outputItr = Dev2ValueObjectFactory.CreateEvaluateIterator(outputPathEntry);

            colItr.AddIterator(outputItr);

            IBinaryDataListEntry usernameEntry = compiler.Evaluate(executionId, enActionType.User, Username, false, out errors);

            allErrors.MergeErrors(errors);
            IDev2DataListEvaluateIterator unameItr = Dev2ValueObjectFactory.CreateEvaluateIterator(usernameEntry);

            colItr.AddIterator(unameItr);

            IBinaryDataListEntry passwordEntry = compiler.Evaluate(executionId, enActionType.User, Password, false, out errors);

            allErrors.MergeErrors(errors);
            IDev2DataListEvaluateIterator passItr = Dev2ValueObjectFactory.CreateEvaluateIterator(passwordEntry);

            colItr.AddIterator(passItr);

            if (dataObject.IsDebugMode())
            {
                AddDebugInputItem(new DebugItemVariableParams(OutputPath, "File or Folder", outputPathEntry, executionId));
                AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
                AddDebugInputItemUserNamePassword(executionId, usernameEntry);
            }

            while (colItr.HasMoreData())
            {
                IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();
                Dev2CRUDOperationTO       opTo   = new Dev2CRUDOperationTO(Overwrite);

                try
                {
                    IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextRow(outputItr).TheValue,
                                                                                 colItr.FetchNextRow(unameItr).TheValue,
                                                                                 colItr.FetchNextRow(passItr).TheValue,
                                                                                 true);

                    IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
                    string result = broker.Create(dstEndPoint, opTo, true);
                    outputs.Add(DataListFactory.CreateOutputTO(Result, result));
                }
                catch (Exception e)
                {
                    outputs.Add(DataListFactory.CreateOutputTO(Result, (string)null));
                    allErrors.AddError(e.Message);
                    break;
                }
            }

            return(outputs);
        }