コード例 #1
0
        private void Install(InstallationTicket ticket, ResourceNode node, IInstallationController controller)
        {
            ShouldReportIfError(ticket, () =>
            {
                _packageObtainer.ObtainPackage(ticket.StorageAddress, (address, error) =>
                {
                    if (error != null)
                    {
                        ReportResult(ticket, error);
                        return;
                    }

                    ShouldReport(ticket, () =>
                    {
                        controller.InstallByTicket(ticket, node, address);
                    });
                });
            });
        }
コード例 #2
0
        public void InstallByTicket(Resource resource, InstallationTicket ticket, IInstallationController controller)
        {
            var nodes = resource.Nodes.Where(x => x.NodeName == ticket.NodeName);

            if (nodes.Count() > 1)
            {
                var message = string.Format("Several nodes was founded with given NodeName: {0}. Use first. TicketId: {1} ", ticket.NodeName, ticket.Id);
                Common.Utility.LogWarn(message);
            }
            else if (!nodes.Any())
            {
                var message = string.Format("Node with given NodeName: {0} wasn't founded. TicketId: {1}", ticket.NodeName, ticket.Id);
                Common.Utility.LogError(message);
                ReportResult(ticket, new InvalidDataException(message));
            }

            var node = nodes.First();

            Task.Factory.StartNew(() =>
            {
                Install(ticket,node,controller);
            });
        }
コード例 #3
0
        public void InstallByTicket(Resource resource, InstallationTicket ticket, IInstallationController controller)
        {
            var nodes = resource.Nodes.Where(x => x.NodeName == ticket.NodeName);

            if (nodes.Count() > 1)
            {
                var message = string.Format("Several nodes was founded with given NodeName: {0}. Use first. TicketId: {1} ", ticket.NodeName, ticket.Id);
                Common.Utility.LogWarn(message);
            }
            else if (!nodes.Any())
            {
                var message = string.Format("Node with given NodeName: {0} wasn't founded. TicketId: {1}", ticket.NodeName, ticket.Id);
                Common.Utility.LogError(message);
                ReportResult(ticket, new InvalidDataException(message));
            }

            var node = nodes.First();

            Task.Factory.StartNew(() =>
            {
                Install(ticket, node, controller);
            });
        }
コード例 #4
0
        private void Install(InstallationTicket ticket, ResourceNode node, IInstallationController controller)
        {
            ShouldReportIfError(ticket, () =>
            {
                _packageObtainer.ObtainPackage(ticket.StorageAddress, (address, error) =>
                {
                    if (error != null)
                    {
                        ReportResult(ticket, error);
                        return;
                    }

                    ShouldReport(ticket, () =>
                    {
                        controller.InstallByTicket(ticket, node, address);
                    });

                });
            });
        }