public void AfterPropertiesSet() { if (cachingEnabled != null) { attributesFactory.SetCachingEnabled(cachingEnabled.Value); } if (clientNotificationEnabled != null) { attributesFactory.SetClientNotificationEnabled(clientNotificationEnabled.Value); } if (lruEntriesLimit != null) { attributesFactory.SetLruEntriesLimit(lruEntriesLimit.Value); } if (cloningEnabled != null) { attributesFactory.SetCloningEnabled(cloningEnabled.Value); } SetStorageProperties(attributesFactory); SetExpirationProperties(attributesFactory); gemfireRegionAttributes = attributesFactory.CreateRegionAttributes(); }
protected void CreateSpawnAreaMatrix(RegionAttributes attributes) { Vector3 matrixLayout = new Vector3( convertToMatrixDimension(this.Size.x, attributes.spawnerSize.x) , convertToMatrixDimension(this.Size.y, attributes.spawnerSize.y) , convertToMatrixDimension(this.Size.z, attributes.spawnerSize.z) ); Vector3 tesselationStart = calcTtesselationStart(matrixLayout, attributes.spawnerSize); Debug.Log( "Creating A Spawn Area Matrix\n" + "\t size:[" + this.Size.x + "," + this.Size.y + "," + this.Size.z + "]" + "\t matrixLayout:[" + matrixLayout.x + "," + matrixLayout.y + "," + matrixLayout.z + "]" + "\t tesselationStart:[" + tesselationStart.x + "," + tesselationStart.y + "," + tesselationStart.z + "]" + "\t spawnerSize:[" + attributes.spawnerSize.x + "," + attributes.spawnerSize.y + "," + attributes.spawnerSize.z + "]" ); for (int nextLayer = 0; nextLayer <= matrixLayout.z; ++nextLayer) { for (int nextColumn = 0; nextColumn <= matrixLayout.y; ++nextColumn) { for (int nextRow = 0; nextRow <= matrixLayout.x; ++nextRow) { Vector3 nextPos = new Vector3(nextRow, nextColumn, nextLayer); CreateSpawnAreaAtMatrixCoords(nextPos, tesselationStart, attributes); } } } }
protected void CreateSpawnAreaAtMatrixCoords( Vector3 matrixPosition, Vector3 matrixMinPoint, RegionAttributes attributes) { /* * Debug.Log ( * "Creating A Spawn Area Within Matrix Cell\n" + "\t matrixPosition:[" + matrixPosition.x + "," + matrixPosition.y + "," + matrixPosition.z + "]" + "\t matrixMinPoint:[" + matrixMinPoint.x + "," + matrixMinPoint.y + "," + matrixMinPoint.z + "]" + ); */ Transform nextSpawnAreaTransform = this.region.spawnAreaPool.Spawn(this.spawnAreaPrefab); if (nextSpawnAreaTransform != null) { SpawnArea nextSpawnArea = nextSpawnAreaTransform.GetComponent <SpawnArea> (); if (nextSpawnArea != null) { //ready to calculate the center point Vector3 nextSpawnAreaCenter = VectorOperators.Multiply(attributes.spawnerSize, matrixPosition) + matrixMinPoint; /* * Debug.Log ( * "Placing The Spawn Area" + nextSpawnArea.ToString () + "\n" + "\t nextSpawnAreaCenter:[" + nextSpawnAreaCenter.x + "," + nextSpawnAreaCenter.y + "," + nextSpawnAreaCenter.z + "]" + ); */ /* * we know that if nextSpawnArea is not null, it has a BoxCollider because it is a * required component */ BoxCollider bbox = nextSpawnArea.GetComponent <BoxCollider> (); bbox.size = attributes.spawnerSize; bbox.center = nextSpawnAreaCenter; this.ZonePopulator.spawnAreas.Add(nextSpawnArea); return; //we can exit now, as we have completed successfully } } //something went wrong, and we didn't create the spawn area as expected Debug.LogError( "Unable to create a new spawn area at " + (matrixPosition + matrixMinPoint).ToString() ); }
private Region CreateRegion() { DistributedSystem dsys = DistributedSystem.Connect("exampleregion"); Cache cache = CacheFactory.Create("exampleregion", dsys); AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.SetScope(ScopeType.Local); attributesFactory.SetCachingEnabled(true); RegionAttributes regionAttributes = attributesFactory.CreateRegionAttributes(); return(cache.CreateRegion("exampleregion", regionAttributes)); }
public void SampleUsage() { // 1. Connect to system Console.WriteLine("{0}Connecting to GemFire", Environment.NewLine); DistributedSystem dsys = DistributedSystem.Connect("exampleregion"); // 2. Create a cache Cache cache = CacheFactory.Create("exampleregion", dsys); // 3. Create default region attributes AttributesFactory af = new AttributesFactory(); RegionAttributes rAttrib = af.CreateRegionAttributes(); // 4. Create region Region region = cache.CreateRegion("exampleregion", rAttrib); }
public void RegionLookup() { Cache cache = (Cache)ctx["gemfire-cache"]; AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.SetScope(ScopeType.Local); attributesFactory.SetCachingEnabled(true); RegionAttributes regionAttributes = attributesFactory.CreateRegionAttributes(); Region existing = cache.CreateRegion("existing", regionAttributes); Assert.IsTrue(ctx.ContainsObject("lookup")); RegionLookupFactoryObject regionLookupFactoryObject = (RegionLookupFactoryObject)ctx.GetObject("&lookup"); Assert.AreEqual("existing", TestUtils.ReadField <string>("name", regionLookupFactoryObject)); //TODO SGFNET-20: existing is not registered as an alias with lookup/. //Assert.AreEqual(ctx.GetObject("existing"), ctx.GetObject("lookup")); }
private static void SetRegion(Region region) { m_region = region; RegionAttributes attrs = m_region.Attributes; if (attrs.ClientNotificationEnabled) { m_region.RegisterAllKeys(); } // Add cache listener callback to region if (attrs.CacheListener == null) { ExampleCacheListenerCallback listenerCallback = new ExampleCacheListenerCallback(); AttributesMutator mutator = m_region.GetAttributesMutator(); mutator.SetCacheListener(listenerCallback); } }
public void RegisterRegexInterest() { // 1. Connect to system Console.WriteLine("{0}Connecting to GemFire", Environment.NewLine); DistributedSystem dsys = DistributedSystem.Connect("empty"); // 2. Create a cache Cache cache = CacheFactory.Create("Cache", dsys); // 2.5 Create Pool //PoolFactory fact = PoolManager.CreateFactory(); //fact.AddServer("localhost", 40404); //fact.SetSubscriptionEnabled(true); //fact.Create("examplePool"); // 3. Create default region attributes AttributesFactory af = new AttributesFactory(); af.SetClientNotificationEnabled(true); //af.SetPoolName("examplePool"); af.SetEndpoints("localhost:40404"); RegionAttributes rAttrib = af.CreateRegionAttributes(); // 4. Create region Region region = cache.CreateRegion("empty", rAttrib); Thread.Sleep(1000); region.RegisterRegex("Keys-*", false, null, false); //RegionFactory regionFact = cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY); //Region region = regionFact.Create("exampleregion"); //region.RegisterRegex(".*", false, new System.Collections.Generic.List<ICacheableKey>()); }
public static bool InRegion(string attribute, object obj) { int serial = AliasCommands.ResolveSerial(obj); if (serial == 0) { UOC.SystemMessage(Strings.Invalid_or_unknown_object_id); return(false); } Entity entity = (Entity)Engine.Items.GetItem(serial) ?? Engine.Mobiles.GetMobile(serial); if (entity == null) { UOC.SystemMessage(Strings.Cannot_find_item___); return(false); } RegionAttributes attr = Utility.GetEnumValueByName <RegionAttributes>(attribute); Region region = entity.GetRegion(); return(region != null && region.Attributes.HasFlag(attr)); }
public void AfterPropertiesSet() { if (cachingEnabled != null) attributesFactory.SetCachingEnabled(cachingEnabled.Value); if (clientNotificationEnabled != null) attributesFactory.SetClientNotificationEnabled(clientNotificationEnabled.Value); if (lruEntriesLimit != null) attributesFactory.SetLruEntriesLimit(lruEntriesLimit.Value); if (cloningEnabled != null) attributesFactory.SetCloningEnabled(cloningEnabled.Value); SetStorageProperties(attributesFactory); SetExpirationProperties(attributesFactory); gemfireRegionAttributes = attributesFactory.CreateRegionAttributes(); }