示例#1
0
        private void InternalValidateDatabaseMode()
        {
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            this.m_database   = this.DataObject.GetDatabase <Database>();
            this.m_dbCopyName = string.Format("{0}\\{1}", this.m_database.Name, this.m_server.Name);
            if (this.m_database.ReplicationType != ReplicationType.Remote)
            {
                base.WriteError(new InvalidRCROperationOnNonRcrDB(this.m_database.Name), ErrorCategory.InvalidOperation, this.Identity);
            }
            if (this.CancelSeed)
            {
                ExTraceGlobals.CmdletsTracer.TraceDebug <string>((long)this.GetHashCode(), "UpdateDatabaseCopy: CancelSeed called for database copy '{0}'", this.m_dbCopyName);
                base.WriteVerbose(Strings.SeederCancelCalled(this.m_dbCopyName));
            }
            if (this.SourceServer != null)
            {
                this.m_sourceServer = (Server)base.GetDataObject <Server>(this.SourceServer, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound(this.SourceServer.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(this.SourceServer.ToString())));
                if (!this.m_sourceServer.IsMailboxServer)
                {
                    base.WriteError(new OperationOnlyOnMailboxServerException(this.m_sourceServer.Name), ErrorCategory.InvalidOperation, this.Identity);
                }
                if (this.m_sourceServer.MajorVersion != Microsoft.Exchange.Data.Directory.SystemConfiguration.Server.CurrentExchangeMajorVersion)
                {
                    base.WriteError(new DagTaskErrorServerWrongVersion(this.m_sourceServer.Name), ErrorCategory.InvalidOperation, this.Identity);
                }
            }
            DatabaseAvailabilityGroup dagForDatabase = DagTaskHelper.GetDagForDatabase(this.m_database, base.DataSession, new Task.TaskErrorLoggingDelegate(base.WriteError));

            DagTaskHelper.PreventTaskWhenTPREnabled(dagForDatabase, this);
        }
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     try
     {
         ExTraceGlobals.CmdletsTracer.TraceDebug <string, DatabaseCopyIdParameter>((long)this.GetHashCode(), "DatabaseCopyStateAction: enter InternalValidate(DB,ident): {0}, {1}", base.DatabaseName, this.Identity);
         base.InternalValidate();
         if (base.HasErrors)
         {
             TaskLogger.LogExit();
         }
         else
         {
             Database database = this.DataObject.GetDatabase <Database>();
             DatabaseAvailabilityGroup dagForDatabase = DagTaskHelper.GetDagForDatabase(database, base.DataSession, new Task.TaskErrorLoggingDelegate(base.WriteError));
             DagTaskHelper.PreventTaskWhenTPREnabled(dagForDatabase, this);
             this.m_UseRpc = ReplayRpcVersionControl.IsSuspendRpcSupported(this.Server.AdminDisplayVersion);
             ServerVersion serverVersion = this.IsReplayLagManagementOperation ? ReplayRpcVersionControl.GetCopyStatusEx4RpcSupportVersion : ReplayRpcVersionControl.SuspendRpcSupportVersion;
             if (this.m_UseRpc)
             {
                 if (this.IsSuspendOperation)
                 {
                     base.WriteVerbose(Strings.SuspendSgcUseRpc(this.Server.AdminDisplayVersion.ToString(), serverVersion.ToString()));
                 }
                 else
                 {
                     base.WriteVerbose(Strings.ResumeSgcUseRpc(this.Server.AdminDisplayVersion.ToString(), serverVersion.ToString()));
                 }
             }
             else if (this.IsReplayLagManagementOperation)
             {
                 base.WriteError(new ReplayLagRpcUnsupportedException(this.Server.Name, this.Server.AdminDisplayVersion.ToString(), ReplayRpcVersionControl.GetCopyStatusEx4RpcSupportVersion.ToString()), ExchangeErrorCategory.ServerOperation, this.Server);
             }
             else if (this.IsSuspendOperation)
             {
                 base.WriteVerbose(Strings.SuspendSgcUseState(this.Server.Name, this.Server.AdminDisplayVersion.ToString(), ReplayRpcVersionControl.SuspendRpcSupportVersion.ToString()));
             }
             else
             {
                 base.WriteVerbose(Strings.ResumeSgcUseState(this.Server.Name, this.Server.AdminDisplayVersion.ToString(), ReplayRpcVersionControl.SuspendRpcSupportVersion.ToString()));
             }
             this.IsActivationRpcSupported      = ReplayRpcVersionControl.IsActivationRpcSupported(this.Server.AdminDisplayVersion);
             this.IsRequestSuspend3RpcSupported = ReplayRpcVersionControl.IsRequestSuspend3RpcSupported(this.Server.AdminDisplayVersion);
             this.IsOperationRunOnSource        = false;
             DatabaseLocationInfo databaseLocationInfo;
             if (database.ReplicationType == ReplicationType.Remote && RemoteReplayConfiguration.IsServerRcrSource(ADObjectWrapperFactory.CreateWrapper(database), ADObjectWrapperFactory.CreateWrapper(this.Server), out databaseLocationInfo))
             {
                 this.IsOperationRunOnSource = true;
             }
             ExTraceGlobals.CmdletsTracer.TraceDebug <string>((long)this.GetHashCode(), "DatabaseCopyStateAction: leave InternalValidate: {0}", base.DatabaseName);
         }
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }