public override void RunNow(Guid mailboxGuid, string parameters)
        {
            StoreMailboxData mailboxData;

            using (ExRpcAdmin exRpcAdmin = ExRpcAdmin.Create("Client=TBA", null, null, null, null))
            {
                try
                {
                    PropValue[][] mailboxTableInfo = exRpcAdmin.GetMailboxTableInfo(base.DatabaseInfo.Guid, mailboxGuid, new PropTag[]
                    {
                        PropTag.MailboxType,
                        PropTag.PersistableTenantPartitionHint,
                        PropTag.LastLogonTime
                    });
                    if (mailboxTableInfo.Length != 1 || mailboxTableInfo[0].Length < 1)
                    {
                        throw new InvalidOperationException("Failed to get the mailbox property");
                    }
                    PropValue           mailboxProperty     = MailboxTableQuery.GetMailboxProperty(mailboxTableInfo[0], PropTag.PersistableTenantPartitionHint);
                    TenantPartitionHint tenantPartitionHint = null;
                    if (mailboxProperty.PropTag == PropTag.PersistableTenantPartitionHint)
                    {
                        byte[] bytes = mailboxProperty.GetBytes();
                        if (bytes != null && bytes.Length != 0)
                        {
                            tenantPartitionHint = TenantPartitionHint.FromPersistablePartitionHint(bytes);
                        }
                    }
                    if (string.IsNullOrEmpty(parameters))
                    {
                        MailboxInformation mailboxInformation = MailboxInformation.Create(mailboxGuid.ToByteArray(), base.DatabaseInfo.Guid, mailboxGuid.ToString(), ControlData.Empty, mailboxTableInfo[0], MailboxInformation.GetLastLogonTime(mailboxTableInfo[0]), tenantPartitionHint);
                        mailboxData = mailboxInformation.MailboxData;
                    }
                    else
                    {
                        mailboxData = new MailboxDataForDemandJob(mailboxGuid, base.DatabaseInfo.Guid, null, parameters, tenantPartitionHint);
                    }
                }
                catch (MapiExceptionNotFound arg)
                {
                    ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug <TimeBasedStoreDatabaseDriver, MapiExceptionNotFound>((long)this.GetHashCode(), "{0}: Mailbox does not exist on the store: {1}", this, arg);
                    if (string.IsNullOrEmpty(parameters))
                    {
                        mailboxData = new StoreMailboxData(mailboxGuid, base.DatabaseInfo.Guid, mailboxGuid.ToString(), null);
                    }
                    else
                    {
                        mailboxData = new MailboxDataForDemandJob(mailboxGuid, base.DatabaseInfo.Guid, null, parameters);
                    }
                }
            }
            ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug <TimeBasedStoreDatabaseDriver, Guid>((long)this.GetHashCode(), "{0}: RunNow: about to start processing mailbox {1} on this database.", this, mailboxGuid);
            base.RunNow(mailboxData);
        }
Ejemplo n.º 2
0
        public static InvokeArgs Create(StoreSession storeSession, TimeSpan timePerTask, MailboxData mailboxData)
        {
            InvokeArgs invokeArgs = InvokeArgs.Create(storeSession, mailboxData);

            invokeArgs.TimePerTask = timePerTask;
            MailboxDataForDemandJob mailboxDataForDemandJob = mailboxData as MailboxDataForDemandJob;

            if (mailboxDataForDemandJob != null)
            {
                invokeArgs.Parameters = mailboxDataForDemandJob.Parameters;
            }
            return(invokeArgs);
        }