/// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="nCache"></param>
        internal InprocCacheEventsListener(CacheEventsListenerBase parent, Alachisoft.NCache.Caching.Cache nCache)
        {
            _listener = parent;
            _nCache   = nCache;


            _itemAdded          = new ItemAddedCallback(this.OnItemAdded);
            _itemUpdated        = new ItemUpdatedCallback(this.OnItemUpdated);
            _itemRemoved        = new ItemRemovedCallback(this.OnItemRemoved);
            _cacheCleared       = new Alachisoft.NCache.Caching.CacheClearedCallback(this.OnCacheCleared);
            _customNotification =
                new Alachisoft.NCache.Caching.CustomNotificationCallback(this.OnCustomNotification);
            _cacheStopped  = new Alachisoft.NCache.Caching.CacheStoppedCallback(this.OnCacheStopped);
            _queryChanged  = new ActiveQueryCallback(this.OnActiveQueryChanged);
            _pollRequested = OnPollNotified;

            _nCache.ItemAdded    += _itemAdded;
            _nCache.ItemUpdated  += _itemUpdated;
            _nCache.ItemRemoved  += _itemRemoved;
            _nCache.CacheCleared += _cacheCleared;
            _nCache.CustomNotif  += _customNotification;
            _nCache.CacheStopped += _cacheStopped;


            _customRemoveCallback = new CustomRemoveCallback(this.OnCustomRemoveCallback);
            _customUpdateCallback = new CustomUpdateCallback(this.OnCustomUpdateCallback);


            _nCache.CustomRemoveCallbackNotif += _customRemoveCallback;
            _nCache.CustomUpdateCallbackNotif += _customUpdateCallback;

            _nCache.ActiveQueryCallbackNotif += _queryChanged;
        }
Ejemplo n.º 2
0
        public BunchOfCaps(Scene scene, Caps caps)
        {
            m_Scene       = scene;
            m_HostCapsObj = caps;
            IConfigSource config = m_Scene.Config;

            if (config != null)
            {
                IConfig sconfig = config.Configs["Startup"];
                if (sconfig != null)
                {
                    m_levelUpload = sconfig.GetInt("LevelUpload", 0);
                }

                IConfig appearanceConfig = config.Configs["Appearance"];
                if (appearanceConfig != null)
                {
                    m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
                }
            }

            m_assetService = m_Scene.AssetService;
            m_regionName   = m_Scene.RegionInfo.RegionName;

            RegisterHandlers();

            AddNewInventoryItem   = m_Scene.AddUploadedInventoryItem;
            ItemUpdatedCall       = m_Scene.CapsUpdateInventoryItemAsset;
            TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
            GetClient             = m_Scene.SceneGraph.GetControllingClient;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Start a cache and provide call backs
        /// </summary>
        /// <param name="cahcheID"></param>
        /// <param name="propertyString"></param>
        /// <param name="itemAdded"></param>
        /// <param name="itemRemoved"></param>
        /// <param name="itemUpdated"></param>
        /// <param name="cacheCleared"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">cacheId is a null reference (Nothing in Visual Basic).</exception>
        public void StartCache(string cacheId, string partitionId,
                               ItemAddedCallback itemAdded,
                               ItemRemovedCallback itemRemoved,
                               ItemUpdatedCallback itemUpdated,
                               CacheClearedCallback cacheCleared,
                               CustomRemoveCallback customRemove,
                               CustomUpdateCallback customUpdate,

                               bool twoPhaseInitialization)
        {
            ManagementCommand command = GetManagementCommand(ManagementUtil.MethodName.StartCache, 7);

            command.Parameters.AddParameter(cacheId);
            command.Parameters.AddParameter(partitionId);

            command.Parameters.AddParameter(null);
            command.Parameters.AddParameter(null);
            command.Parameters.AddParameter(null);
            command.Parameters.AddParameter(null);
            command.Parameters.AddParameter(null);
            command.Parameters.AddParameter(null);


            command.Parameters.AddParameter(twoPhaseInitialization);

            ExecuteCommandOnCacehServer(command);
        }
Ejemplo n.º 4
0
 public override void StartCache(string cacheId,
                                 ItemAddedCallback itemAdded,
                                 ItemRemovedCallback itemRemoved,
                                 ItemUpdatedCallback itemUpdated,
                                 CacheClearedCallback cacheCleared,
                                 CustomRemoveCallback customRemove,
                                 CustomUpdateCallback customUpdate)
 {
     StartCache(cacheId, null, itemAdded, itemRemoved, itemUpdated, cacheCleared, customRemove, customUpdate, false);
 }
Ejemplo n.º 5
0
        public override void StartCache(string cacheId, string partitionId,
                                        ItemAddedCallback itemAdded,
                                        ItemRemovedCallback itemRemoved,
                                        ItemUpdatedCallback itemUpdated,
                                        CacheClearedCallback cacheCleared,
                                        CustomRemoveCallback customRemove,
                                        CustomUpdateCallback customUpdate,

                                        bool twoPhaseInitialization)
        {
            if (cacheId == null)
            {
                throw new ArgumentNullException("cacheId");
            }
            ContainCacheProcess = true;

            LeasedCache cache = null;

            _rwLock.AcquireWriterLock(Timeout.Infinite);
            try
            {
                try
                {
                    LoadConfiguration(cacheId);
                }
                catch (Exception e)
                {
                    string msg = String.Format("CacheServer failed to load configuration, Error {0}", e.Message);
                    AppUtil.LogEvent(msg, EventLogEntryType.Warning);
                    ContainCacheProcess = false;
                }

                cacheInfo = GetCacheInfo(cacheId.ToLower());

                if (cacheInfo != null)
                {
                    cache = cacheInfo.Cache;
                }
                try
                {
                    StartCacheInstance(cache, cacheInfo, itemAdded, itemRemoved, itemUpdated, cacheCleared, customRemove, customUpdate, twoPhaseInitialization);
                    AppUtil.LogEvent(_cacheserver, "\"" + cacheId + "\"" + " started successfully.", EventLogEntryType.Information, EventCategories.Information, EventID.CacheStart);
                }
                catch (Exception e)
                {
                    AppUtil.LogEvent(_cacheserver, "\"" + cacheId + "\" can not be started.\n" + e.ToString(), System.Diagnostics.EventLogEntryType.Error, EventCategories.Error, EventID.CacheStartError);
                    ContainCacheProcess = false;
                    throw;
                }
            }
            finally
            {
                _rwLock.ReleaseWriterLock();
            }
        }
Ejemplo n.º 6
0
        private void StartCacheInstance(LeasedCache cache, CacheInfo cacheInfo,
                                        ItemAddedCallback itemAdded,
                                        ItemRemovedCallback itemRemoved,
                                        ItemUpdatedCallback itemUpdated,
                                        CacheClearedCallback cacheCleared,
                                        CustomRemoveCallback customRemove,
                                        CustomUpdateCallback customUpdate,
                                        bool twoPhaseInitialization)
        {
            if (cache != null)
            {
                if (itemAdded != null)
                {
                    cache.ItemAdded += itemAdded;
                }
                if (itemRemoved != null)
                {
                    cache.ItemRemoved += itemRemoved;
                }
                if (itemUpdated != null)
                {
                    cache.ItemUpdated += itemUpdated;
                }
                if (cacheCleared != null)
                {
                    cache.CacheCleared += cacheCleared;
                }
                if (customRemove != null)
                {
                    cache.CustomRemoveCallbackNotif += customRemove;
                }
                if (customUpdate != null)
                {
                    cache.CustomUpdateCallbackNotif += customUpdate;
                }

                if (!cache.IsRunning)
                {
                    cacheInfo.SyncConfiguration();
                    cache.StartInstance(Renderer, twoPhaseInitialization);

#if COMMUNITY
                    if (InstrumentCache.OnCacheStarted != null)
                    {
                        InstrumentCache.OnCacheStarted(cache.Name);
                    }
#endif
                }
            }

            else
            {
                throw new Runtime.Exceptions.ManagementException("Specified cacheId is not registered");
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates a cache object by parsing configuration string passed as parameter.
        /// </summary>
        /// <param name="propertyString">property string provided by the user </param>
        /// <param name="itemAdded">item added handler</param>
        /// <param name="itemRemoved">item removed handler</param>
        /// <param name="itemUpdated">item updated handler</param>
        /// <param name="cacheMiss">cache miss handler</param>
        /// <param name="cacheCleared">cache cleared handler</param>
        /// <returns>return the Cache object</returns>
        static public Cache CreateFromPropertyString(string propertyString,
                                                     ItemAddedCallback itemAdded,
                                                     ItemRemovedCallback itemRemoved,
                                                     ItemUpdatedCallback itemUpdated,
                                                     CacheClearedCallback cacheCleared,
                                                     CustomRemoveCallback customRemove,
                                                     CustomUpdateCallback customUpdate)
        {
            ConfigReader propReader = new PropsConfigReader(propertyString);

            return(CreateFromProperties(propReader.Properties, itemAdded, itemRemoved, itemUpdated, cacheCleared, customRemove, customUpdate));
        }
Ejemplo n.º 8
0
        private void StartCacheInstance(LeasedCache cache, CacheInfo cacheInfo,
                                        ItemAddedCallback itemAdded,
                                        ItemRemovedCallback itemRemoved,
                                        ItemUpdatedCallback itemUpdated,
                                        CacheClearedCallback cacheCleared,
                                        CustomRemoveCallback customRemove,
                                        CustomUpdateCallback customUpdate,
                                        bool twoPhaseInitialization)
        {
            if (cache != null)
            {
                if (itemAdded != null)
                {
                    cache.ItemAdded += itemAdded;
                }
                if (itemRemoved != null)
                {
                    cache.ItemRemoved += itemRemoved;
                }
                if (itemUpdated != null)
                {
                    cache.ItemUpdated += itemUpdated;
                }
                if (cacheCleared != null)
                {
                    cache.CacheCleared += cacheCleared;
                }
                if (customRemove != null)
                {
                    cache.CustomRemoveCallbackNotif += customRemove;
                }
                if (customUpdate != null)
                {
                    cache.CustomUpdateCallbackNotif += customUpdate;
                }

                if (!cache.IsRunning)
                {
                    cacheInfo.SyncConfiguration();
                    cache.StartInstance(Renderer, twoPhaseInitialization);

                    if (InstrumentCache.OnCacheStarted != null)
                    {
                        InstrumentCache.OnCacheStarted(cache.Name);
                    }
                }
            }

            else
            {
                throw new Runtime.Exceptions.ManagementException(ErrorCodes.CacheInit.CACHE_ID_NOT_REGISTERED, ErrorMessages.GetErrorMessage(ErrorCodes.CacheInit.CACHE_ID_NOT_REGISTERED));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Creates a cache object by reading in cofiguration parameters from a .NET XML file.
        /// </summary>
        /// <param name="configFileName">Name and/or path of the configuration file.</param>
        /// <param name="configSection">Name and/or ID of the section in the configuration file.</param>
        /// <param name="itemAdded">item added handler</param>
        /// <param name="itemRemoved">item removed handler</param>
        /// <param name="itemUpdated">item updated handler</param>
        /// <param name="cacheMiss">cache miss handler</param>
        /// <param name="cacheCleared">cache cleared handler</param>
        /// <returns>return the Cache object</returns>
        static public Cache CreateFromXmlConfig(string configFileName,
                                                string configSection,
                                                ItemAddedCallback itemAdded,
                                                ItemRemovedCallback itemRemoved,
                                                ItemUpdatedCallback itemUpdated,
                                                CacheClearedCallback cacheCleared,
                                                CustomRemoveCallback customRemove,
                                                CustomUpdateCallback customUpdate)
        {
            ConfigReader xmlReader = new XmlConfigReader(configFileName, configSection);

            return(CreateFromProperties(xmlReader.Properties, itemAdded, itemRemoved, itemUpdated, cacheCleared, customRemove, customUpdate));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Internal method that actually creates the cache. A HashMap containing the config parameters
        /// is passed to this method.
        /// </summary>
        /// <param name="propertyTable">contains the properties provided by the user in the for of Hashtable</param>
        /// <param name="itemAdded">item added handler</param>
        /// <param name="itemRemoved">item removed handler</param>
        /// <param name="itemUpdated">item updated handler</param>
        /// <param name="cacheMiss">cache miss handler</param>
        /// <param name="cacheCleared">cache cleared handler</param>
        /// <returns>return the Cache object</returns>
        static private Cache CreateFromProperties(IDictionary properties,
                                                  CacheServerConfig config,
                                                  ItemAddedCallback itemAdded,
                                                  ItemRemovedCallback itemRemoved,
                                                  ItemUpdatedCallback itemUpdated,
                                                  CacheClearedCallback cacheCleared,
                                                  CustomRemoveCallback customRemove,
                                                  CustomUpdateCallback customUpdate,
                                                  string userId,
                                                  string password,
                                                  bool isStartingAsMirror,
                                                  bool twoPhaseInitialization)
        {
            Cache cache = new Cache();

            cache.Configuration = config;

            if (itemAdded != null)
            {
                cache.ItemAdded += itemAdded;
            }
            if (itemRemoved != null)
            {
                cache.ItemRemoved += itemRemoved;
            }
            if (itemUpdated != null)
            {
                cache.ItemUpdated += itemUpdated;
            }
            if (cacheCleared != null)
            {
                cache.CacheCleared += cacheCleared;
            }

            if (customRemove != null)
            {
                cache.CustomRemoveCallbackNotif += customRemove;
            }
            if (customUpdate != null)
            {
                cache.CustomUpdateCallbackNotif += customUpdate;
            }

            cache.Initialize(properties, true, isStartingAsMirror, twoPhaseInitialization);
            return(cache);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Internal method that actually creates the cache. A HashMap containing the config parameters
        /// is passed to this method.
        /// </summary>
        /// <param name="propertyTable">contains the properties provided by the user in the for of Hashtable</param>
        /// <param name="itemAdded">item added handler</param>
        /// <param name="itemRemoved">item removed handler</param>
        /// <param name="itemUpdated">item updated handler</param>
        /// <param name="cacheMiss">cache miss handler</param>
        /// <param name="cacheCleared">cache cleared handler</param>
        /// <returns>return the Cache object</returns>
        static private Cache CreateFromProperties(IDictionary properties,
                                                  ItemAddedCallback itemAdded,
                                                  ItemRemovedCallback itemRemoved,
                                                  ItemUpdatedCallback itemUpdated,
                                                  CacheClearedCallback cacheCleared,
                                                  CustomRemoveCallback customRemove,
                                                  CustomUpdateCallback customUpdate)
        {
            Cache cache = new Cache();


            if (itemAdded != null)
            {
                cache.ItemAdded += itemAdded;
            }
            if (itemRemoved != null)
            {
                cache.ItemRemoved += itemRemoved;
            }
            if (itemUpdated != null)
            {
                cache.ItemUpdated += itemUpdated;
            }
            if (cacheCleared != null)
            {
                cache.CacheCleared += cacheCleared;
            }

            if (customRemove != null)
            {
                cache.CustomRemoveCallbackNotif += customRemove;
            }
            if (customUpdate != null)
            {
                cache.CustomUpdateCallbackNotif += customUpdate;
            }

            cache.Initialize(properties, true);
            return(cache);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Internal method that actually creates the cache. A HashMap containing the config parameters
 /// is passed to this method.
 /// </summary>
 /// <param name="propertyTable">contains the properties provided by the user in the for of Hashtable</param>
 /// <param name="itemAdded">item added handler</param>
 /// <param name="itemRemoved">item removed handler</param>
 /// <param name="itemUpdated">item updated handler</param>
 /// <param name="cacheMiss">cache miss handler</param>
 /// <param name="cacheCleared">cache cleared handler</param>
 /// <returns>return the Cache object</returns>
 static private Cache CreateFromProperties(IDictionary properties,
                                           ItemAddedCallback itemAdded,
                                           ItemRemovedCallback itemRemoved,
                                           ItemUpdatedCallback itemUpdated,
                                           CacheClearedCallback cacheCleared,
                                           CustomRemoveCallback customRemove,
                                           CustomUpdateCallback customUpdate,
                                           string userId,
                                           string password)
 {
     return(CreateFromProperties(properties,
                                 null,
                                 itemAdded,
                                 itemRemoved,
                                 itemUpdated,
                                 cacheCleared,
                                 customRemove,
                                 customUpdate,
                                 userId,
                                 password,
                                 false,
                                 false));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Register callbacks with cache.
        /// </summary>
        /// <param name="type"></param>
        public void RegisterNotification(NotificationsType type)
        {
            switch (type)
            {
            case NotificationsType.RegAddNotif:
                if (_itemAdded == null)
                {
                    _itemAdded        = new ItemAddedCallback(ItemAdded);
                    _cache.ItemAdded += _itemAdded;
                }
                break;

            case NotificationsType.RegUpdateNotif:
                if (_itemUpdated == null)
                {
                    _itemUpdated        = new ItemUpdatedCallback(ItemUpdated);
                    _cache.ItemUpdated += _itemUpdated;
                }
                break;

            case NotificationsType.RegRemoveNotif:
                if (_itemRemoved == null)
                {
                    _itemRemoved        = new ItemRemovedCallback(ItemRemoved);
                    _cache.ItemRemoved += _itemRemoved;
                }
                break;

            case NotificationsType.RegClearNotif:
                if (_cacheCleared == null)
                {
                    _cacheCleared        = new CacheClearedCallback(CacheCleared);
                    _cache.CacheCleared += _cacheCleared;
                }
                break;

            case NotificationsType.RegCustomNotif:
                if (_customNotif == null)
                {
                    _customNotif        = new CustomNotificationCallback(CustomNotification);
                    _cache.CustomNotif += _customNotif;
                }
                break;

            case NotificationsType.RegNodeJoinedNotif:
                if (_nodeJoined == null)
                {
                    _nodeJoined          = new NodeJoinedCallback(NodeJoined);
                    _cache.MemberJoined += _nodeJoined;
                }
                break;

            case NotificationsType.RegNodeLeftNotif:
                if (_nodeLeft == null)
                {
                    _nodeLeft          = new NodeLeftCallback(NodeLeft);
                    _cache.MemberLeft += _nodeLeft;
                }
                break;

            case NotificationsType.RegCacheStoppedNotif:

                _cacheStopped        = new CacheStoppedCallback(OnCacheStopped);
                _cache.CacheStopped += _cacheStopped;
                this._cacheStoppedEventRegistered = true;
                break;



#if !DEVELOPMENT
            case NotificationsType.RegHashmapChangedNotif:
                if (this._hashmapChanged == null)
                {
                    this._hashmapChanged        = new HashmapChangedCallback(HashmapChanged);
                    this._cache.HashmapChanged += this._hashmapChanged;
                }
                break;
#endif
            case NotificationsType.UnregAddNotif:
                if (_itemAdded != null)
                {
                    _cache.ItemAdded -= _itemAdded;
                    _itemAdded        = null;
                    lock (sync_lock_AddDataFilter)
                    {
                        ItemAddedFilter = EventDataFilter.None;
                        _addSeq         = -1;
                    }
                }
                break;

            case NotificationsType.UnregUpdateNotif:
                if (_itemUpdated != null)
                {
                    _cache.ItemUpdated -= _itemUpdated;
                    _itemUpdated        = null;
                    lock (sync_lock_UpdateDataFilter = -1)
                    {
                        ItemUpdatedFilter = EventDataFilter.None;
                        _updateSeq        = -1;
                    }
                }
                break;

            case NotificationsType.UnregRemoveNotif:
                if (_itemRemoved != null)
                {
                    _cache.ItemRemoved -= _itemRemoved;
                    _itemRemoved        = null;
                    lock (sync_lock_RemoveDataFilter)
                    {
                        ItemRemovedFilter = EventDataFilter.None;
                        _removeSeq        = -1;
                    }
                }
                break;

            case NotificationsType.UnregClearNotif:
                if (_cacheCleared != null)
                {
                    _cache.CacheCleared -= _cacheCleared;
                    _cacheCleared        = null;
                }
                break;

            case NotificationsType.UnregCustomNotif:
                if (_customNotif != null)
                {
                    _cache.CustomNotif -= _customNotif;
                    _customNotif        = null;
                }
                break;

            case NotificationsType.UnregNodeJoinedNotif:
                if (_nodeJoined != null)
                {
                    _cache.MemberJoined -= _nodeJoined;
                    _nodeJoined          = null;
                }
                break;



            case NotificationsType.UnregNodeLeftNotif:
                if (_nodeLeft != null)
                {
                    _cache.MemberLeft -= _nodeLeft;
                    _nodeLeft          = null;
                }
                break;

            case NotificationsType.UnregCacheStoppedNotif:
                this._cacheStoppedEventRegistered = false;
                break;


#if !DEVELOPMENT
            case NotificationsType.UnregHashmapChangedNotif:
                if (this._hashmapChanged != null)
                {
                    this._cache.HashmapChanged -= this._hashmapChanged;
                    this._hashmapChanged        = null;
                }
                break;
#endif
            }
        }
Ejemplo n.º 14
0
        public BunchOfCaps(Scene scene, Caps caps)
        {
            m_Scene = scene;
            m_HostCapsObj = caps;
            IConfigSource config = m_Scene.Config;
            if (config != null)
            {
                IConfig sconfig = config.Configs["Startup"];
                if (sconfig != null)
                    m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
            }

            m_assetService = m_Scene.AssetService;
            m_regionName = m_Scene.RegionInfo.RegionName;

            RegisterHandlers();

            AddNewInventoryItem = m_Scene.AddUploadedInventoryItem;
            ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset;
            TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
            CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS;
            GetClient = m_Scene.SceneContents.GetControllingClient;

        }
Ejemplo n.º 15
0
        public BunchOfCaps(Scene scene, Caps caps)
        {
            m_Scene = scene;
            m_HostCapsObj = caps;

            // create a model upload cost provider
            m_ModelCost = new ModelCost();
            // tell it about scene object limits
            m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys;
            m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys;
            m_ModelCost.ObjectLinkedPartsMax = m_Scene.m_linksetCapacity;
            
//            m_ModelCost.ObjectLinkedPartsMax = ??
//            m_ModelCost.PrimScaleMin = ??

            m_PrimScaleMin = m_ModelCost.PrimScaleMin;
            float modelTextureUploadFactor = m_ModelCost.ModelTextureCostFactor;
            float modelUploadFactor = m_ModelCost.ModelMeshCostFactor;
            float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor;
            float modelPrimCreationCost = m_ModelCost.primCreationCost;
            float modelMeshByteCost = m_ModelCost.bytecost;

            IConfigSource config = m_Scene.Config;
            if (config != null)
            {
                IConfig sconfig = config.Configs["Startup"];
                if (sconfig != null)
                {
                    m_levelUpload = sconfig.GetInt("LevelUpload", 0);
                }

                IConfig appearanceConfig = config.Configs["Appearance"];
                if (appearanceConfig != null)
                {
                    m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
                }
                // economy for model upload
                IConfig EconomyConfig = config.Configs["Economy"];
                if (EconomyConfig != null)
                {
                    modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor);
                    modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor);
                    modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor);
                    // next 2 are normalized so final cost is afected by modelUploadFactor above and normal cost
                    modelPrimCreationCost = EconomyConfig.GetFloat("ModelPrimCreationCost", modelPrimCreationCost);
                    modelMeshByteCost = EconomyConfig.GetFloat("ModelMeshByteCost", modelMeshByteCost);

                    m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", m_enableModelUploadTextureToInventory);

                    m_RestrictFreeTestUploadPerms = EconomyConfig.GetBoolean("m_RestrictFreeTestUploadPerms", m_RestrictFreeTestUploadPerms);
                    m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", m_enableFreeTestUpload);
                    m_ForceFreeTestUpload = EconomyConfig.GetBoolean("ForceFreeTestUpload", m_ForceFreeTestUpload);
                    string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", "");
                    if (testcreator != "")
                    {
                        UUID id;
                        UUID.TryParse(testcreator, out id);
                        if (id != null)
                            m_testAssetsCreatorID = id;
                    }

                    m_ModelCost.ModelMeshCostFactor = modelUploadFactor;
                    m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor;
                    m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor;
                    m_ModelCost.primCreationCost = modelPrimCreationCost;
                    m_ModelCost.bytecost = modelMeshByteCost;
                }
            }

            m_assetService = m_Scene.AssetService;
            m_regionName = m_Scene.RegionInfo.RegionName;

            RegisterHandlers();

            AddNewInventoryItem = m_Scene.AddUploadedInventoryItem;
            ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset;
            TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
            GetClient = m_Scene.SceneGraph.GetControllingClient;

            m_FileAgentInventoryState = FileAgentInventoryState.idle;
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Unregister the callbacks registered with cache
        /// </summary>

        private void UnRegisterNotifications()
        {
            if (_onItemUpdatedCallback != null)
            {
                _cache.CustomUpdateCallbackNotif -= _onItemUpdatedCallback;
                _onItemUpdatedCallback            = null;
            }
            if (_onItemRemoveCallback != null)
            {
                _cache.CustomRemoveCallbackNotif -= _onItemRemoveCallback;
                _onItemRemoveCallback             = null;
            }
            if (_pollRequestCallback != null)
            {
                _cache.PollRequestCallbackNotif -= _pollRequestCallback;
                _pollRequestCallback             = null;
            }

            if (_cacheCleared != null)
            {
                _cache.CacheCleared -= _cacheCleared;
                _cacheCleared        = null;
            }
            if (_cacheStopped != null)
            {
                _cache.CacheStopped -= _cacheStopped;
                _cacheStopped        = null;
            }
            if (_onCompactTypeModifiedCallback != null)
            {
                _cache.CompactTypeModified    -= _onCompactTypeModifiedCallback;
                _onCompactTypeModifiedCallback = null;
            }

            if (_asyncOperationCallback != null)
            {
                _cache.AsyncOperationCompleted -= _asyncOperationCallback;
                _asyncOperationCallback         = null;
            }
            if (_dsUpdatedCallback != null)
            {
                _cache.DataSourceUpdated -= _dsUpdatedCallback;
                _dsUpdatedCallback        = null;
            }

            if (_itemAdded != null)
            {
                _cache.ItemAdded -= _itemAdded;
                _itemAdded        = null;
                lock (sync_lock_AddDataFilter)
                {
                    ItemAddedFilter = EventDataFilter.None;
                    _addSeq         = -1;
                }
            }
            if (_itemUpdated != null)
            {
                _cache.ItemUpdated -= _itemUpdated;
                _itemUpdated        = null;
                lock (sync_lock_UpdateDataFilter)
                {
                    ItemUpdatedFilter = EventDataFilter.None;
                    _updateSeq        = -1;
                }
            }
            if (_itemRemoved != null)
            {
                _cache.ItemRemoved -= _itemRemoved;
                _itemRemoved        = null;
                lock (sync_lock_RemoveDataFilter)
                {
                    ItemRemovedFilter = EventDataFilter.None;
                    _removeSeq        = -1;
                }
            }

            if (_customNotif != null)
            {
                _cache.CustomNotif -= _customNotif;
                _customNotif        = null;
            }

            if (_nodeJoined != null)
            {
                _cache.MemberJoined -= _nodeJoined;
                _nodeJoined          = null;
            }
            if (_nodeLeft != null)
            {
                _cache.MemberLeft -= _nodeLeft;
                _nodeLeft          = null;
            }
            if (_cacheBecomeActive != null)
            {
                _cache.CacheBecomeActive -= _cacheBecomeActive;
                _cacheBecomeActive        = null;
            }
            if (_configModified != null)
            {
                _cache.ConfigurationModified -= _configModified;
                _configModified = null;
            }

#if !DEVELOPMENT
            if (this._hashmapChanged != null)
            {
                this._cache.HashmapChanged -= this._hashmapChanged;
                _hashmapChanged             = null;
            }
#endif

            if (_operationModeChanged != null)
            {
                _cache.OperationModeChanged -= _operationModeChanged;
                _operationModeChanged        = null;
            }
            if (this._blockClientActivity != null)
            {
                this._cache.BlockActivity -= this._blockClientActivity;
                _blockClientActivity       = null;
            }

            if (this._unblockClientActivity != null)
            {
                this._cache.UnBlockActivity -= this._unblockClientActivity;
                _unblockClientActivity       = null;
            }
        }
        public BunchOfCaps(Scene scene, Caps caps)
        {
            m_Scene = scene;
            m_HostCapsObj = caps;
            IConfigSource config = m_Scene.Config;
            if (config != null)
            {
                IConfig sconfig = config.Configs["Startup"];
                if (sconfig != null)
                {
                    m_levelUpload = sconfig.GetInt("LevelUpload", 0);
                }

                IConfig appearanceConfig = config.Configs["Appearance"];
                if (appearanceConfig != null)
                {
                    m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
                }
            }

            m_assetService = m_Scene.AssetService;
            m_regionName = m_Scene.RegionInfo.RegionName;

            RegisterHandlers();

            AddNewInventoryItem = m_Scene.AddUploadedInventoryItem;
            ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset;
            TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
            GetClient = m_Scene.SceneGraph.GetControllingClient;
        }