示例#1
0
        private void ReceiveLoadChildrenTask([NotNull] LoadChildLocationQuery loadQuery)
        {
            if (!TaskCanceled)
            {
                _log.Debug("Entered LoadTask");

                if (loadQuery.Location == null)
                {
                    throw new ArgumentException("The location must not be empty ");
                }

                var akkaFriendlyActorId = loadQuery.Location.UniqueId.Replace('/', '_');

                if (!locationActors.ContainsKey(akkaFriendlyActorId))
                {
                    IActorRef newLocationActor =
                        Context.ActorOf(LocationActor.Props(
                                            dataService), akkaFriendlyActorId);

                    locationActors.Add(akkaFriendlyActorId, newLocationActor);
                }

                locationActors[akkaFriendlyActorId].Tell(loadQuery);
            }
        }
示例#2
0
        private void InitiateLoadTask(LoadTask loadTask)
        {
            if (!TaskCanceled)
            {
                this.elevatedPrivileges = loadTask.ElevatedPrivileges.Value;

                Start = DateTime.Now;

                Title = loadTask.Title;

                // cleanup repository
                if (loadTask.StartLocation.Scope == Enums.Scope.Farm)
                {
                    // clear repository synchronous before loading
                    repository.Clear();

                    // it could take some time to clear the repository, and errors could happen,
                    // so the task could be canceled meanwhile ...
                    if (!TaskCanceled)
                    {
                        // initiate read of all feature definitions
                        var fdQuery = new Messages.Request.LoadFeatureDefinitionQuery(Id);


                        featureDefinitionActor.Tell(fdQuery);


                        // initiate read of farm location, start location is null
                        var loadFarm = new LoadChildLocationQuery(Id, null, elevatedPrivileges);

                        farmLoadActor.Tell(loadFarm);
                    }
                }
                else
                {
                    //TODO: clear only start location and belonging activatedfeatures and definitions ...
                    throw new NotImplementedException("As start location for load task, currently only farm level is supported.");
                }

                var loadChildren = new LoadChildLocationQuery(
                    Id,
                    loadTask.StartLocation,
                    elevatedPrivileges);

                // load web applications as farm children
                ReceiveLoadChildrenTask(loadChildren);
            }
        }
        private void ReceiveLoadChildLocationQuery(LoadChildLocationQuery message)
        {
            _log.Debug("Entered LocationActor-LookupLocationHandlyLoadLocationQuery");

            if (!TaskCanceled)
            {
                try
                {
                    var location = message.Location;

                    if (location == null)
                    {
                        var loadedFarm = dataService.LoadFarm();
                        Sender.Tell(loadedFarm);
                    }
                    else
                    {
                        if (location.Scope == Core.Models.Enums.Scope.Farm)
                        {
                            var loadedWebApps = dataService.LoadWebApps();
                            Sender.Tell(loadedWebApps);
                        }
                        else
                        {
                            var loadedChildren = dataService.LoadWebAppChildren(location, message.ElevatedPrivileges);
                            Sender.Tell(loadedChildren);
                        }
                    }
                }
                catch (Exception ex)
                {
                    string tip = message.ElevatedPrivileges ? string.Empty : " Please try to check the option 'Elevated Privileges'.";


                    var cancelationMsg = new CancelMessage(
                        message.TaskId,
                        "Error loading farm hierarchy." + tip,
                        true,
                        ex
                        );

                    Sender.Tell(cancelationMsg);
                }
            }
        }
示例#4
0
        private void ReceiveLocationsLoaded([NotNull] LoadedDto message)
        {
            TrackLocationsProcessed(message);

            // if web apps are loaded, load children
            if (message.Parent != null && message.Parent.Scope == Enums.Scope.Farm)
            {
                foreach (Location l in message.ChildLocations)
                {
                    //TODO: Here, it could be checked, if a site collection is e.g. locked or readonly

                    if (l.Scope == Enums.Scope.WebApplication)
                    {
                        // initiate read of locations
                        var loadWebAppChildren = new LoadChildLocationQuery(Id, l, elevatedPrivileges);
                        ReceiveLoadChildrenTask(loadWebAppChildren);
                    }
                }
            }

            repository.AddLoadedLocations(message);

            SendProgress();
        }