Exemplo n.º 1
0
        static void CopyOperationCreationEventHandler(Object sender,
                                                      Object data, ref int dummy)
        {
            FC.CopyOperation          cop          = (FC.CopyOperation)sender;
            List <FC.IFileRepository> repositories = (List <FC.IFileRepository>)data;

            foreach (FC.IFileRepository repository in repositories)
            {
                crmInstance.LogBackupOperation("Attempting initial backup...",
                                               repository.Name, "This stage creates the backup operation and requests it's execution.\nDuring this stage, errors may occur due to unreachable targets. If this occurs, this message will be kept", 0);
            }

            foreach (FC.IFileRepository repository in repositories)
            {
                try {
                    repository.CreateDirectory(account);
                } catch (FCE.FileOperation fe) {
                    SCLP.LogProxy.Log(SCLP.LogLevel.Error,
                                      String.Format("On-boot backup failed to {0} failed.",
                                                    fe.TargetName));
                    crmInstance.LogBackupOperation("Initial backup failed.",
                                                   fe.TargetName, String.Format("Failure to initialize target {0}. On-boot backup failed.", fe.TargetName), 0);
                    FCSH.EventHub.FailureHandler(sender, new Object[2] {
                        fe, cop.transferInterval
                    }, ref dummy);
                }
            }
            SCB.Backup.AddBackupOperation(@"C:\Program Files\MenuMate",
                                          repositories);

            SCB.Backup.PerformBackups();
            cop.ExecuteOperation();
        }
Exemplo n.º 2
0
 private void BuildCopyOperation(XmlNode opNode)
 {
     if (opNode.Attributes["enabled"].Value == @"true")
     {
         CopyOperation o = new CopyOperation(opNode);
         _operations.Add(o);
         LogManager.GetLogger("FileMate").Info(o.ToString());
     }
 }
Exemplo n.º 3
0
 public CopyOperationErrorBlock(
     FC.CopyOperation operation,
     Timer operationHeartbeat)
 {
     collectedErrors         = new List <Exception>();
     this.operation          = operation;
     this.operationHeartbeat = operationHeartbeat;
     resumeQuantum           = 0;
 }
Exemplo n.º 4
0
        void CopyOperationFailureEventHandler(Object sender,
                                              Object datum, ref int dummy)
        {
            Object [] data = (Object [])datum;
            CopyOperationErrorBlock errorBlock;

            FC.CopyOperation operation = (FC.CopyOperation)sender;
            String           trace     = "";

            SCLP.LogProxy.Log(SCLP.LogLevel.Error,
                              String.Format(
                                  String.Format("Transfer to target {0} has failed!",
                                                ((FCE.Base)data[1]).TargetName)));
            crmInstance.LogBackupOperation("Backup Failure.", ((FCE.Base)data[1]).TargetName,
                                           String.Format("Backup to target {0} failed.", ((FCE.Base)data[1]).TargetName), operation.lastTransferSize);

            SCLP.LogProxy.Log(SCLP.LogLevel.Error,
                              String.Format(
                                  "{0} is now being monitored for further errors.",
                                  operation.Name));

            for (Exception e = (Exception)data[1]; e != null;)
            {
                trace += String.Format(
                    "Message:{0}\nStack Trace:{1}\n", e.Message, e.StackTrace);
                e = e.InnerException;
            }

            try {
                errorBlock = failedCopyOperations[operation.Name];
            } catch {
                errorBlock = new CopyOperationErrorBlock(
                    operation, (Timer)data[0]);
                failedCopyOperations.Add(operation.Name,
                                         errorBlock);
            }

            resumeFailedOperationMonitor.Enabled |=
                errorBlock.CollectError((Exception)data[1]);
        }