示例#1
0
 /// <summary>
 /// Step execution
 /// </summary>
 /// <param name="request"></param>
 public override void HandleExecute(ChainRequest request)
 {
     //Custome Request
     myRequest = (ButlerProcessRequest)request;
     //Media context
     MediaContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
     if (IdenpotenceControl())
     {
         //Create empty asset
         currentAsset = CreateAsset();
         //Update Asset Id in the process context
         myRequest.AssetId = currentAsset.Id;
         //Ingest all Mezzamine File to asset
         IngestAssets();
         //Set MP4 as primary
         setPrimaryFile();
         //mark for idenpotence
         myRequest.MetaData.Add(this.GetType() + "_" + myRequest.ProcessInstanceId, myRequest.AssetId);
     }
     else
     {
         string txtMessage = string.Format("{0} IdenpotenceControl {1} instanceID {2} was trigger, not ingest Files", this.GetType(), myRequest.ProcessTypeId, myRequest.ProcessInstanceId);
         Trace.TraceInformation(txtMessage);
         myRequest.AssetId = myRequest.MetaData[this.GetType() + "_" + myRequest.ProcessInstanceId];
     }
 }
 /// <summary>
 /// Step execution, create AMS SAS URL for current asset
 /// </summary>
 /// <param name="request"></param>
 public override void HandleExecute(ChainRequest request)
 {
     myRequest            = (ButlerProcessRequest)request;
     _MediaServiceContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
     StorageManager       = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
     buildlocator();
 }
示例#3
0
        public ChainModel Execute(ChainRequest request)
        {
            var chain = _graph.Behaviors.SingleOrDefault(c => c.UniqueId == request.Id);
            if(chain == null)
            {
                throw new ArgumentException("{0} does not exist".ToFormat(request.Id));
            }

            return new ChainModel
                       {
                           Chain = chain,
                           Constraints = _constraintResolver.Resolve(chain),
                           Behaviors = chain.Select(x =>
                                                        {
                                                            var behavior = new BehaviorModel {BehaviorType = x.ToString()};
                                                            var call = x as ActionCall;
                                                            if(call != null)
                                                            {
                                                                behavior.Logs = _graph.Observer.GetLog(call);
                                                            }

                                                            return behavior;
                                                        })
                       };
        }
示例#4
0
        public override void HandleExecute(ChainRequest request)
        {
            myRequest = (ButlerProcessRequest)request;
            var           myBlobManager  = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
            IjsonKeyValue dotControlData = myBlobManager.GetProcessConfig(myRequest.ButlerRequest.ControlFileUri, myRequest.ProcessTypeId);

            switch (dotControlData.Read(DotControlConfigKeys.SelectAssetByType))
            {
            case "assetid":
                myRequest.AssetId = dotControlData.Read(DotControlConfigKeys.SelectAssetByValue);
                break;

            default:
                var    _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
                string AssetName             = dotControlData.Read(DotControlConfigKeys.SelectAssetByValue);
                try
                {
                    IAsset asset = (from m in _MediaServicesContext.Assets select m).Where(m => m.Name == AssetName).FirstOrDefault();
                    myRequest.AssetId = asset.Id;
                }
                catch (Exception X)
                {
                    throw new Exception("Error Loading Asset by name " + AssetName);
                }

                break;
            }
        }
        public override void HandleExecute(ChainRequest request)
        {
            //1. Step Setup
            myRequest             = (ButlerProcessRequest)request;
            _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
            myEncodigSupport      = new EncoderSupport(_MediaServicesContext);
            myBlobManager         = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
            IjsonKeyValue dotControlData = myBlobManager.GetDotControlData(myRequest.ButlerRequest.ControlFileUri);
            IjsonKeyValue processData    = new jsonKeyValue(myBlobManager.GetButlerConfigurationValue(ProcessConfigKeys.DefualtPartitionKey, myRequest.ProcessTypeId + ".config"));

            IjsonKeyValue allPorcessData = myBlobManager.GetProcessConfig(myRequest.ButlerRequest.ControlFileUri, myRequest.ProcessTypeId);

            //2. Get Current Asset
            IAsset asset = (from m in _MediaServicesContext.Assets select m).Where(m => m.Id == myRequest.AssetId).FirstOrDefault();

            //3. JOB parameters
            string OutputAssetsName   = asset.Name + "_mbGridEncode";
            string JobName            = string.Format("GridEncodeStep_{1}_{0}", myRequest.ProcessInstanceId, asset.Name);
            string MediaProcessorName = myEncodigSupport.GetMediaProcessorName(allPorcessData, DotControlConfigKeys.GridEncodeStepMediaProcessorName, "Media Encoder Standard");

            string[] encodeConfigurations = myEncodigSupport.GetLoadEncodignProfiles(dotControlData, processData, DotControlConfigKeys.GridEncodeStepEncodeConfigList, myRequest.ButlerRequest.MezzanineFiles, myRequest.ProcessConfigConn, this.StepConfiguration);

            //4. Execute JOB and Wait
            IJob currentJob = myEncodigSupport.ExecuteGridJob(OutputAssetsName, JobName, MediaProcessorName, encodeConfigurations, "Grid Task", asset.Id, MyEncodigSupport_OnJobError, MyEncodigSupport_JobUpdate);

            //9. Update AssetID
            myRequest.AssetId = currentJob.OutputMediaAssets.FirstOrDefault().Id;
        }
示例#6
0
        public override void HandleExecute(ChainRequest request)
        {
            myRequest             = (ButlerProcessRequest)request;
            _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
            myBlobManager         = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
            allPorcessData        = myBlobManager.GetProcessConfig(myRequest.ButlerRequest.ControlFileUri, myRequest.ProcessTypeId);
            //1. Select VTT
            IAsset asset   = (from m in _MediaServicesContext.Assets select m).Where(m => m.Id == myRequest.AssetId).FirstOrDefault();
            var    vttFile = (from f in asset.AssetFiles select f).Where(f => f.Name.EndsWith(".vtt")).FirstOrDefault();

            vttFile.Download(myRequest.ProcessInstanceId);
            string readText = File.ReadAllText(myRequest.ProcessInstanceId);

            System.IO.File.Delete(myRequest.ProcessInstanceId);

            //2. Cognitive Service
            IAzureMLTextAnalyticsClient myClient = new AzureMLTextAnalyticsClient();
            Language myLanguage   = (Language)Enum.Parse(typeof(Language), allPorcessData.Read(DotControlConfigKeys.TextAnalitycsStepLanguage));
            string   apiURL       = allPorcessData.Read(DotControlConfigKeys.TextAnalitycsStepApiURL);
            string   apiKey       = allPorcessData.Read(DotControlConfigKeys.TextAnalitycsStepApiKey);
            FileType ft           = FileType.VTT;
            string   jsonResponse = myClient.keyPhrasesTxt(readText, myLanguage, ft, apiURL, apiKey);

            //3. Add File
            string assetFileName = "keyPhrases." + myRequest.ProcessInstanceId + ".txt";
            var    xf            = asset.AssetFiles.Create(assetFileName);

            File.WriteAllText(assetFileName, jsonResponse);
            xf.Upload(assetFileName);
            File.Delete(myRequest.ProcessInstanceId);
            asset.Update();
        }
示例#7
0
        public ChainModel Get(ChainRequest request)
        {
            var chain = _graph.Behaviors.SingleOrDefault(c => c.UniqueId == request.Id);

            if (chain == null)
            {
                throw new UnknownObjectException(request.Id);
            }

            return(new ChainModel
            {
                Chain = chain,
                Constraints = _constraintResolver.Resolve(chain),
                Behaviors = chain.Select(x =>
                {
                    var behavior = new BehaviorModel {
                        BehaviorType = x.ToString()
                    };
                    var call = x as ActionCall;
                    if (call != null)
                    {
                        behavior.Logs = _graph.Observer.GetLog(call);
                    }

                    return behavior;
                })
            });
        }
示例#8
0
        public override void HandleCompensation(ChainRequest request)
        {
            myRequest = (ButlerProcessRequest)request;
            string errorTxt = string.Format("[{0}] process Type {1} instance {2} has not compensation method", this.GetType().FullName, myRequest.ProcessTypeId, myRequest.ProcessInstanceId);

            Trace.TraceWarning(errorTxt);
        }
示例#9
0
        /// <summary>
        /// Step execution
        /// </summary>
        /// <param name="request"></param>
        public override void HandleExecute(ChainRequest request)
        {
            //My request
            myRequest = (ButlerProcessRequest)request;
            //Media Context
            _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
            //0 Encoding Helper
            myEncodigSupport = new EncoderSupport(_MediaServicesContext);
            //1. Storage Manager
            myStorageManager = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
            //2. Load Original Asset (current on context)
            myAssetOriginal = (from m in _MediaServicesContext.Assets select m).Where(m => m.Id == myRequest.AssetId).FirstOrDefault();

            if (IdenpotenceControl())
            {
                ConvertMP4toSmooth(myAssetOriginal);
            }
            else
            {
                //Job Just wait for finish the current job
                myEncodigSupport.OnJobError += MyEncodigSupport_OnJobError;
                myEncodigSupport.JobUpdate  += MyEncodigSupport_JobUpdate;
                myEncodigSupport.WaitJobFinish(currentJob.Id);
            }
            //Update AssetID
            myRequest.AssetId = currentJob.OutputMediaAssets.FirstOrDefault().Id;
        }
        public override void HandleExecute(ChainRequest request)
        {
            myRequest   = (ButlerProcessRequest)request;
            blobManager = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
            IjsonKeyValue stepConfig = new jsonKeyValue(StepConfiguration);

            //Lead External Step from DLL
            try
            {
                blobManager.parkingNewBinaries();
                myCustomStepExecution = buildCustomStep(stepConfig.Read("AssemblyName"), stepConfig.Read("TypeName"));
            }
            catch (Exception X)
            {
                sendError("MediaButlerCustomStep Loading error : " + X.Message);
            }

            //Transform ButlerProcessRequest to ICustomRequest
            myCustomRequest = buildRequest(myRequest);
            //Execute sync
            try
            {
                myCustomStepExecution.execute(myCustomRequest);

                //UPdate myRequest
                myRequest.AssetId = myCustomRequest.AssetId;
            }
            catch (Exception X)
            {
                sendError("MediaButlerCustomStep Execute error " + X.Message);
            }
            //Update status
            UpdateProcessStatus(myRequest, "Finish Custome Execution");
        }
        /// <summary>
        /// Step execution to create AMS locator for current asset
        /// </summary>
        /// <param name="request"></param>
        public override void HandleExecute(ChainRequest request)
        {
            myRequest            = (ButlerProcessRequest)request;
            _MediaServiceContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);

            var locator = CreateStreamingLocator(myRequest.AssetId);
        }
        public override void HandleExecute(ChainRequest request)
        {
            myRequest             = (ButlerProcessRequest)request;
            _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);

            IAsset theAsset = (from m in _MediaServicesContext.Assets select m).Where(m => m.Id == myRequest.AssetId).FirstOrDefault();

            theAsset.Delete();
        }
示例#13
0
        public void should_throw_unknown_chain_exception_if_chain_cannot_be_found()
        {
            var request = new ChainRequest {
                Id = Guid.NewGuid()
            };

            Exception <UnknownObjectException>
            .ShouldBeThrownBy(() => ClassUnderTest.Get(request));
        }
示例#14
0
        public ChainModel Execute(ChainRequest request)
        {
            var visualizer = _visualizer.VisualizerFor(request.Id);
            if(visualizer == null)
            {
                throw new ArgumentException("{0} does not exist".ToFormat(request.Id));
            }

            return visualizer;
        }
示例#15
0
        public ChainModel Execute(ChainRequest request)
        {
            var visualizer = _visualizer.VisualizerFor(request.Id);

            if (visualizer == null)
            {
                throw new ArgumentException("{0} does not exist".ToFormat(request.Id));
            }

            return(visualizer);
        }
示例#16
0
        public override void HandleExecute(ChainRequest request)
        {
            myRequest            = (ButlerProcessRequest)request;
            _MediaServiceContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
            IAsset x             = _MediaServiceContext.Assets.Where(xx => xx.Id == myRequest.AssetId).FirstOrDefault();
            string recordPattern = "[IAssetFile] /{0}/{1}";

            foreach (IAssetFile xFile in x.AssetFiles)
            {
                myRequest.Log.Add(string.Format(recordPattern, x.Uri.Segments[1], xFile.Name));
            }
        }
示例#17
0
        public void should_set_chain_on_model_when_found()
        {
            var chain   = _graph.BehaviorFor(typeof(DashboardRequestModel));
            var request = new ChainRequest {
                Id = chain.UniqueId
            };

            ClassUnderTest
            .Get(request)
            .Chain
            .ShouldEqual(chain);
        }
示例#18
0
 /// <summary>
 /// Step compensation on errror, delete asset
 /// </summary>
 /// <param name="request"></param>
 public override void HandleCompensation(ChainRequest request)
 {
     if (currentAsset != null)
     {
         string id = currentAsset.Id;
         currentAsset.Delete();
         Trace.TraceWarning("{0} HandleCompensation in process {2} processId {1}, with asset deletion assetid {3}", this.GetType().FullName, request.ProcessInstanceId, request.ProcessTypeId, id);
     }
     else
     {
         Trace.TraceWarning("{0} HandleCompensation in process {2} processId {1}, without asset deletion", this.GetType().FullName, request.ProcessInstanceId, request.ProcessTypeId);
     }
 }
示例#19
0
        public override void HandleExecute(ChainRequest request)
        {
            myRequest = (ButlerProcessRequest)request;

            sshCommandConfig myConfig = Newtonsoft.Json.JsonConvert.DeserializeObject <sshCommandConfig>(this.StepConfiguration);

            myBridge = sshCommandStep.constructBridge(myConfig);

            string exitCode         = string.Format(ExitCodePatter, myRequest.ProcessInstanceId);
            string customSshCommand = myBridge.buildCommand(sshCommandStep.internalValues(myRequest), myRequest.MetaData);

            myBridge.WaitForProcessEnd(customSshCommand, exitCode, myRequest.ProcessInstanceId);
            myRequest.Log.Add(string.Format("[0] finish to execute at {1} ------------------------------", myRequest.ProcessInstanceId, DateTime.Now.ToString()));
        }
示例#20
0
        /// <summary>
        /// Step execution
        /// </summary>
        /// <param name="request"></param>
        public override void HandleExecute(ChainRequest request)
        {
            myRequest            = (ButlerProcessRequest)request;
            _MediaServiceContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);

            ////Get transcode asset
            //Lista all media parent from current Asset
            IAsset myAsset = (from m in _MediaServiceContext.Assets select m).Where(m => m.Id == myRequest.AssetId).FirstOrDefault();

            foreach (IAsset xParent in myAsset.ParentAssets)
            {
                if (xParent.Name.Contains(myRequest.ProcessInstanceId))
                {
                    //Delete parent asset becouse it is part of the Media blutler process instance
                    xParent.Delete();
                }
            }
        }
示例#21
0
        public override void HandleExecute(ChainRequest request)
        {
            myRequest   = (ButlerProcessRequest)request;
            blobManager = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);

            sshCommandConfig myConfig = Newtonsoft.Json.JsonConvert.DeserializeObject <sshCommandConfig>(this.StepConfiguration);

            myBridge = sshCommandStep.constructBridge(myConfig);

            string customSshCommand = myBridge.buildCommand(sshCommandStep.internalValues(myRequest), myRequest.MetaData);

            myRequest.Log.Add(string.Format("[0] Start to execute at {1} Command {2}", myRequest.ProcessInstanceId, DateTime.Now.ToString(), customSshCommand));

            myBridge.execCommand(customSshCommand);

            string message = string.Format("[{0}] {3}  Result {1}: {2}", myRequest.ProcessInstanceId, myBridge.ResultCode, myBridge.Result, DateTime.Now.ToString());

            myRequest.Log.Add(message);
        }
        public override void HandleExecute(ChainRequest request)
        {
            myRequest   = (ButlerProcessRequest)request;
            blobManager = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);

            string jsonControlFile = blobManager.ReadTextBlob(new Uri(myRequest.ButlerRequest.ControlFileUri));

            dotControlConfig = new jsonKeyValue(jsonControlFile);
            if (dotControlConfig.Read(MediaButler.Common.DotControlConfigKeys.httpNotificationStepGetOnFinishUrl) != "")
            {
                //GET
                HttpGetNotification();
            }
            else
            {
                //POST
                HttpPostNotification();
            }
        }
        /// <summary>
        /// Hidden message on process start or realease message at process ends
        /// </summary>
        /// <param name="request"></param>
        public override void HandleExecute(ChainRequest request)
        {
            ButlerProcessRequest myRequest = (ButlerProcessRequest)request;

            Setup();
            if (myRequest.MessageHiddenTaskStatus == TaskStatus.WaitingToRun)
            {
                //Start to hidden the Process trgigger Message
                myRequest.StartMessageHidden(timeSpanMessage, sleepSeconds);
                Trace.TraceInformation("{0}Process type {1} instance {2} start hidden Message {3}",
                                       this.GetType().FullName,
                                       myRequest.ProcessTypeId,
                                       myRequest.ProcessInstanceId,
                                       myRequest.ButlerRequest.MessageId);
            }
            else
            {
                //Hidden is running, now Stop it
                myRequest.StopMessageHidden();
                do
                {
                    System.Threading.Thread.Sleep(1 * 1000);
                } while (myRequest.MessageHiddenTaskStatus != TaskStatus.RanToCompletion);


                Trace.TraceInformation("{0}Process type {1} instance {2} stop hidden Message {3}",
                                       this.GetType().FullName,
                                       myRequest.ProcessTypeId,
                                       myRequest.ProcessInstanceId,
                                       myRequest.ButlerRequest.MessageId);

                //DELETE MESSAGE Butler request
                myRequest.DeleteCurrentMessage();

                Trace.TraceInformation("{0}Process type {1} instance {2} delete Message {3}",
                                       this.GetType().FullName,
                                       myRequest.ProcessTypeId,
                                       myRequest.ProcessInstanceId,
                                       myRequest.ButlerRequest.MessageId);
            }
        }
        public void PersistProcessStatus(ChainRequest request)
        {
            ProcessSnapShot mysh = new ProcessSnapShot(request.ProcessTypeId, request.ProcessInstanceId);

            try
            {
                Newtonsoft.Json.JsonSerializerSettings x = new Newtonsoft.Json.JsonSerializerSettings();
                x.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
                mysh.jsonContext        = Newtonsoft.Json.JsonConvert.SerializeObject(request, Newtonsoft.Json.Formatting.None, x);

                mysh.CurrentStep = request.CurrentStepIndex;

                PersistProcessStatus(mysh);
            }
            catch (Exception X)
            {
                string txtMessage = string.Format("[{0}] Persist Process Status Error at process {1} instance {2}: error messagase  {3}", this.GetType().FullName, request.ProcessInstanceId, request.ProcessTypeId, X.Message);
                Trace.TraceError(txtMessage);
                throw new Exception(txtMessage);
            }
        }
示例#25
0
        public override void HandleExecute(ChainRequest request)
        {
            //1. Setup Step
            myRequest             = (ButlerProcessRequest)request;
            _MediaServicesContext = new CloudMediaContext(new MediaServicesCredentials(myRequest.MediaAccountName, myRequest.MediaAccountKey));
            myEncodigSupport      = new EncoderSupport(_MediaServicesContext);
            myBlobManager         = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
            allPorcessData        = myBlobManager.GetProcessConfig(myRequest.ButlerRequest.ControlFileUri, myRequest.ProcessTypeId);

            //2. Create Jobs definition
            List <IJobConfiguration> myJobsDefinition = GetJobConfig(myRequest.ProcessInstanceId, myRequest.AssetId, "");

            //3. Execute
            myEncodigSupport.ExecuteMultiJobTaskEncode(myJobsDefinition, myRequest.ProcessInstanceId, MyEncodigSupport_OnJobError, MyEncodigSupport_JobUpdate);

            //4. Update context with output asset ID
            myRequest.AssetId = UpdateOutPut(myJobsDefinition, this.consolidateId);

            //5. Copy all asset files to Output asset and delete all temp Asset
            ConsolidateOutputs(myJobsDefinition, consolidateId);
        }
        public override void HandleExecute(ChainRequest request)
        {
            myRequest             = (ButlerProcessRequest)request;
            _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
            myBlobManager         = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);
            //IjsonKeyValue dotControlData = myBlobManager.GetDotControlData(myRequest.ButlerRequest.ControlFileUri);
            IjsonKeyValue dotControlData = myBlobManager.GetProcessConfig(myRequest.ButlerRequest.ControlFileUri, myRequest.ProcessTypeId);

            string searchServiceName = dotControlData.Read(DotControlConfigKeys.InjectTTMLSearchServiceName);
            string adminApiKey       = dotControlData.Read(DotControlConfigKeys.InjectTTMLadminApiKey);
            string indexName         = dotControlData.Read(DotControlConfigKeys.InjectTTMLindexName);

            SearchServiceClient serviceClient = new SearchServiceClient(searchServiceName, new SearchCredentials(adminApiKey));

            if (!serviceClient.Indexes.Exists(indexName))
            {
                CreateVideoTextIndex(serviceClient, indexName);
            }

            IAsset asset = (from m in _MediaServicesContext.Assets select m).Where(m => m.Id == myRequest.AssetId).FirstOrDefault();

            UploadTTML(serviceClient, indexName, asset);
        }
        public override void HandleExecute(ChainRequest request)
        {
            myRequest             = (ButlerProcessRequest)request;
            _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey);
            myBlobManager         = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn);

            IAsset asset = (from m in _MediaServicesContext.Assets select m).Where(m => m.Id == myRequest.AssetId).FirstOrDefault();

            //Asset
            CloudStorageAccount assetStorageCount = CloudStorageAccount.Parse(myRequest.MediaStorageConn);
            CloudBlobClient     assetClient       = assetStorageCount.CreateCloudBlobClient();
            CloudBlobContainer  assetContainer    = assetClient.GetContainerReference(asset.Uri.Segments[1]);

            //Stage Storage
            CloudStorageAccount MezzamineStorageCount = CloudStorageAccount.Parse(myRequest.ButlerRequest.StorageConnectionString);
            CloudBlobClient     MezzamineClient       = MezzamineStorageCount.CreateCloudBlobClient();
            CloudBlobContainer  MezzamineContainer    = MezzamineClient.GetContainerReference(myRequest.ButlerRequest.WorkflowName);
            string         filterXmlFileName          = "_azuremediaservices.config";
            string         filterXmlBlobName          = string.Format("Processing/{0}/{1}", myRequest.ProcessInstanceId, filterXmlFileName);
            CloudBlockBlob azureMediaServicesConfig   = MezzamineContainer.GetBlockBlobReference(filterXmlBlobName);

            myBlobManager.CopyBlob(azureMediaServicesConfig, assetContainer, filterXmlFileName);
        }
 /// <summary>
 /// Execute step
 /// </summary>
 /// <param name="request"></param>
 public override void HandleExecute(ChainRequest request)
 {
     myRequest = (ButlerProcessRequest)request;
     //Send output info back using ButlerResponse Message LOG
     SendMessage();
 }
示例#29
0
        public HtmlDocument Chain(ChainRequest chainRequest)
        {
            var behaviorChain = _graph.Behaviors.FirstOrDefault(chain => chain.UniqueId == chainRequest.Id);
            if (behaviorChain == null)
            {
                return BuildDocument("Unknown chain", new HtmlTag("span").Text("No behavior chain registered with ID: " + chainRequest.Id));
            }
            var heading = new HtmlTag("h1").Modify(t =>
            {
                t.Add("span").Text("Chain ");
                t.Add("span").AddClass("chainId").Text(behaviorChain.UniqueId.ToString());
            });
            var document = new HtmlTag("div");
            document.Child(new HtmlTag("div").Text("Route: " + behaviorChain.RoutePattern));

            var nodeTable = new TableTag();
            nodeTable.AddHeaderRow(header =>
            {
                header.Header("Category");
                header.Header("Description");
                header.Header("Type");
            });
            behaviorChain.Each(node => nodeTable.AddBodyRow(row =>
            {
                row.Cell().Text(node.Category.ToString());
                row.Cell().Text(node.ToString());
                row.Cell().Text(node.GetType().FullName);
            }));
            return BuildDocument("Chain " + chainRequest.Id, heading, document, new HtmlTag("h2").Text("Nodes:"), nodeTable);
        }
示例#30
0
 /// <summary>
 /// Compensation error delete outputs
 /// </summary>
 /// <param name="request"></param>
 public override void HandleCompensation(ChainRequest request)
 {
     deleteOutput();
     deleteOtiginalAsset();
 }
示例#31
0
 public abstract void HandleRequest(ChainRequest request);
示例#32
0
        public HtmlDocument Chain(ChainRequest chainRequest)
        {
            var title = "Chain " + chainRequest.Id;

            var behaviorChain = _graph.Behaviors.FirstOrDefault(chain => chain.UniqueId == chainRequest.Id);
            if (behaviorChain == null)
            {
                return BuildDocument("Unknown chain", new HtmlTag("span").Text("No behavior chain registered with ID: " + chainRequest.Id));
            }

            var content = new HtmlTag("div").AddClass("main-content");

            var document = new HtmlTag("div");
            var pattern = behaviorChain.RoutePattern;
            if( pattern == string.Empty )
            {
                pattern = "(default)";
            }
            document.Child(new HtmlTag("div").Text("Route: " + pattern));

            var nodeTable = new TableTag();
            nodeTable.AddHeaderRow(header =>
            {
                header.Header("Category");
                header.Header("Description");
                header.Header("Type");
            });
            foreach (var node in behaviorChain)
            {

                var description = node.ToString().HtmlEncode().ConvertCRLFToBreaks();
                nodeTable.AddBodyRow(row =>
                {
                    row.Cell().Text(node.Category.ToString());
                    row.Cell().UnEncoded().Text(description);
                    row.Cell().Text(node.GetType().FullName);
                    if (description.Contains(_diagnosticsNamespace))
                    {
                        row.AddClass(FUBU_INTERNAL_CLASS);
                    }
               });
            }

            var logDiv = new HtmlTag("div").AddClass("convention-log");
            var ul = logDiv.Add("ul");

            var observer = _graph.Observer;
            behaviorChain.Calls.Each(
                call => observer.GetLog(call).Each(
                            entry => ul.Add("li").Text(entry)));

            content.AddChildren(new[]{
                document,
                new HtmlTag("h3").Text("Nodes:"),
                nodeTable,
                new HtmlTag("h3").Text("Log:"),
                logDiv});

            return BuildDocument(title, content);
        }
 public override void HandleCompensation(ChainRequest request)
 {
     Trace.TraceWarning("{0} in process {1} processId {2} has not HandleCompensation", this.GetType().FullName, myRequest.ProcessTypeId, myRequest.ProcessInstanceId);
 }