private static void ProcessSingleOperation(OperationRequest operationRequest) { if (operationRequest.PublishWebContent != null) { ProcessPublishWebContent(operationRequest.PublishWebContent); } if (operationRequest.UpdateWebContentOperation != null) { ProcessUpdateWebContent(operationRequest.UpdateWebContentOperation); } if (operationRequest.SubscriberNotification != null) { WorkerSupport.ExecuteSubscription(operationRequest.SubscriberNotification); } if (operationRequest.RefreshDefaultViewsOperation != null) { WorkerSupport.RefreshDefaultViews(operationRequest.RefreshDefaultViewsOperation); } if (operationRequest.DeleteEntireOwner != null) { VirtualOwner virtualOwner = new VirtualOwner(operationRequest.DeleteEntireOwner.ContainerName, operationRequest.DeleteEntireOwner.LocationPrefix); DeleteEntireOwner(virtualOwner); } if (operationRequest.DeleteOwnerContent != null) { VirtualOwner virtualOwner = new VirtualOwner(operationRequest.DeleteOwnerContent.ContainerName, operationRequest.DeleteOwnerContent.LocationPrefix); DeleteOwnerContent(virtualOwner); } if (operationRequest.SubscriptionChainRequest != null) { WorkerSupport.ExecuteSubscriptionChain(operationRequest.SubscriptionChainRequest); } }
public static OperationRequest SyncTemplatesToSite(string sourceContainerName, string sourcePathRoot, string targetContainerName, string targetPathRoot, bool useQueuedWorker, bool renderWhileSync) { if (useQueuedWorker) { OperationRequest envelope = new OperationRequest { UpdateWebContentOperation = new UpdateWebContentOperation { SourceContainerName = sourceContainerName, SourcePathRoot = sourcePathRoot, TargetContainerName = targetContainerName, TargetPathRoot = targetPathRoot, RenderWhileSync = renderWhileSync } }; //QueueSupport.PutToDefaultQueue(envelope); return(envelope); } else { WorkerSupport.WebContentSync(sourceContainerName, sourcePathRoot, targetContainerName, targetPathRoot, renderWhileSync ? (WorkerSupport.PerformCustomOperation)RenderWebSupport.RenderingSyncHandler : (WorkerSupport.PerformCustomOperation)RenderWebSupport.CopyAsIsSyncHandler); return(null); } }
public static void ProcessUpdateWebContent(UpdateWebContentOperation operation) { string sourceContainerName = operation.SourceContainerName; string sourcePathRoot = operation.SourcePathRoot; string targetContainerName = operation.TargetContainerName; string targetPathRoot = operation.TargetPathRoot; bool renderWhileSync = operation.RenderWhileSync; WorkerSupport.WebContentSync(sourceContainerName, sourcePathRoot, targetContainerName, targetPathRoot, renderWhileSync ? (WorkerSupport.PerformCustomOperation)RenderWebSupport.RenderingSyncHandler : (WorkerSupport.PerformCustomOperation)RenderWebSupport.CopyAsIsSyncHandler); }
public static OperationRequest RefreshDefaultViews(string viewLocation, string fullTypeName, bool useQueuedWorker) { OperationRequest operationRequest = new OperationRequest { RefreshDefaultViewsOperation = new RefreshDefaultViewsOperation { ViewLocation = viewLocation, TypeNameToRefresh = fullTypeName } }; if (useQueuedWorker) { return(operationRequest); } WorkerSupport.RefreshDefaultViews(operationRequest.RefreshDefaultViewsOperation); return(null); }
public static bool ProcessOwnerSubscriptionChains(IContainerOwner lockedOwner, string acquiredEtag, string containerName) { try { if (containerName != null) { InformationContext.Current.InitializeCloudStorageAccess(containerName: containerName); } string[] blobs = SubscribeSupport.GetChainRequestList(lockedOwner); var chainContent = blobs.Select(blob => StorageSupport.RetrieveInformation(blob, typeof(SubscriptionChainRequestContent))).Cast <SubscriptionChainRequestContent>().ToArray(); const double invalidSubscriptionSubmissionTimeInSeconds = 600; if (chainContent.Any(item => item.SubmitTime < DateTime.UtcNow.AddSeconds(-invalidSubscriptionSubmissionTimeInSeconds))) { return(false); } WorkerSupport.ExecuteSubscriptionChains(chainContent); foreach (string blob in blobs) { StorageSupport.DeleteBlob(blob); } } catch (Exception ex) { ErrorSupport.ReportException(ex); throw; } finally { SubscribeSupport.ReleaseChainLock(lockedOwner, acquiredEtag); if (containerName != null) { InformationContext.ProcessAndClearCurrent(); } } counter++; if (counter >= 1000) { QueueSupport.ReportStatistics("Processed " + counter + " messages..."); counter = 0; } return(true); }
public static bool CopyAsIsSyncHandler(CloudBlob source, CloudBlob target, WorkerSupport.SyncOperationType operationtype) { return false; }
public static bool RenderingSyncHandler(CloudBlob source, CloudBlob target, WorkerSupport.SyncOperationType operationtype) { // Don't delete informationobject types of target folders if (operationtype == WorkerSupport.SyncOperationType.Delete) { if(target.GetBlobInformationType() == StorageSupport.InformationType_InformationObjectValue) return true; return false; } if (operationtype == WorkerSupport.SyncOperationType.Copy) { // Custom rendering for web templates if(source.GetBlobInformationType() == StorageSupport.InformationType_WebTemplateValue) { RenderWebSupport.RenderTemplateWithContentToBlob(source, target); return true; } // Don't copy source dir information objects if(source.GetBlobInformationType() == StorageSupport.InformationType_InformationObjectValue) { return true; } return false; } return false; }