public void CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
        {
            Logger.WriteLine("Closing export connection: {0}", exportRunStep.Reason);
            this.timer.Stop();

            if (exportRunStep.Reason != CloseReason.Normal)
            {
                this.cancellationToken?.Cancel();
            }

            try
            {
                Logger.WriteLine("Writing {0} delta entries to file", CSEntryChangeQueue.Count);
                CSEntryChangeQueue.SaveQueue(this.DeltaPath, this.operationSchemaTypes);
            }
            catch (Exception ex)
            {
                Logger.WriteLine("An error occurred while saving the delta file");
                Logger.WriteException(ex);
                throw;
            }

            Logger.WriteSeparatorLine('*');
            Logger.WriteLine("Operation statistics");
            Logger.WriteLine("Export objects: {0}", this.opCount);
            Logger.WriteLine("Operation time: {0}", this.timer.Elapsed);
            Logger.WriteLine("Ops/sec: {0:N3}", this.opCount / this.timer.Elapsed.TotalSeconds);
            Logger.WriteSeparatorLine('*');
        }
        /// <summary>
        /// Ends an export session
        /// </summary>
        /// <param name="exportRunStep">The results of the export session close</param>
        void IMAExtensible2CallExport.CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
        {
            OperationBase operation = MAConfig.GlobalOperations.FirstOrDefault(t => t is ExportEndOperation);

            if (operation != null)
            {
                try
                {
                    SshConnection.ExecuteOperation(operation);
                }
                catch (Exception ex)
                {
                    Logger.WriteLine("Could not perform export end operation");
                    Logger.WriteException(ex);
                    throw new ExtensibleExtensionException("Export end operation failed", ex);
                }
            }

            try
            {
                SshConnection.CloseSshConnection();
            }
            catch (Exception ex)
            {
                Logger.WriteLine("Could not close SSH connection");
                Logger.WriteException(ex);
            }

            Logger.WriteLine("Export Complete");
            Logger.WriteSeparatorLine('*');
        }
Esempio n. 3
0
        public void CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
        {
            logger.Info($"Closing export connection: {exportRunStep.Reason}");

            if (this.exportContext == null)
            {
                logger.Trace("No export context detected");
                return;
            }

            this.exportContext.Timer.Stop();

            if (exportRunStep.Reason != CloseReason.Normal)
            {
                if (this.exportContext.CancellationTokenSource != null)
                {
                    logger.Info("Cancellation request received");
                    this.exportContext.CancellationTokenSource.Cancel();
                    this.exportContext.CancellationTokenSource.Token.WaitHandle.WaitOne();
                    logger.Info("Cancellation completed");
                }
            }

            logger.Info("Export operation complete");
            logger.Info($"Exported { this.exportContext.ExportedItemCount} objects");
            logger.Info($"Export duration: {this.exportContext.Timer.Elapsed}");

            if (this.exportContext.ExportedItemCount > 0 && this.exportContext.Timer.Elapsed.TotalSeconds > 0)
            {
                logger.Info($"Speed: {(this.exportContext.ExportedItemCount / this.exportContext.Timer.Elapsed.TotalSeconds):N2} obj/sec");
                logger.Info($"Average: {(this.exportContext.Timer.Elapsed.TotalSeconds / this.exportContext.ExportedItemCount):N2} sec/obj");
            }
        }
Esempio n. 4
0
 public void CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
 {
     foreach (var repoContainer in _objectSources)
     {
         repoContainer.Dispose();
     }
 }
Esempio n. 5
0
 public void CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
 {
     try
     {
         this.CloseRSAConnection();
     }
     catch (Exception ex)
     {
         EmailError(ex);
         throw ex;
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Ends an export session
        /// </summary>
        /// <param name="exportRunStep">The results of the export session close</param>
        public void CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
        {
            try
            {
                this.client.ExportEnd();
                this.Close();

                Logger.WriteLine("Export Complete");
                Logger.WriteSeparatorLine('*');
            }
            catch (Exception ex)
            {
                Logger.WriteException(ex);
                throw;
            }
        }
Esempio n. 7
0
 void IMAExtensible2CallExport.CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
 {
     Tracer.Enter("closeexportconnection");
     try
     {
         CloseRunspace();
         Dispose();
     }
     catch (Exception ex)
     {
         Tracer.TraceError("closeexportconnection", ex);
         throw;
     }
     finally
     {
         Tracer.Exit("closeexportconnection");
     }
 }
Esempio n. 8
0
 public void CloseExportConnectionDetached(CloseExportConnectionRunStep exportRunStep)
 {
     Tracer.Enter(nameof(CloseExportConnectionDetached));
     try
     {
         if (Configuration.RunAfterExport)
         {
             List <SqlParameter> parameters = new List <SqlParameter>();
             parameters.Add(new SqlParameter("exporttype", ExportType.ToString()));
             methods.RunStoredProcedure(Configuration.ExportCommandAfter, parameters);
         }
         methods.CloseConnection();
     }
     catch (Exception ex)
     {
         Tracer.TraceError(nameof(CloseExportConnectionDetached), ex);
         throw;
     }
     finally
     {
         Tracer.Exit(nameof(CloseExportConnectionDetached));
     }
 }
Esempio n. 9
0
 // CloseExportConnection
 public void CloseExportConnection(CloseExportConnectionRunStep _exportRunStep)
 {
     utils.Logger(TraceEventType.Information,
                  ConstDefinition.ID0900_START_CLOSEEXPORTCONNECTION,
                  ConstDefinition.MSG0900_START_CLOSEEXPORTCONNECTION);
 }
Esempio n. 10
0
 public void CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
 {
     // Save the items in the queue to the specified file
     CSEntryChangeQueue.SaveQueue(this.filename, this.operationSchema);
 }
 public void CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
 {
     //conn.Close();
 }
Esempio n. 12
0
 void IMAExtensible2CallExport.CloseExportConnection(CloseExportConnectionRunStep exportRunStep)
 {
     CloseExportConnectionDetached(exportRunStep);
 }