Example #1
0
 /// <summary>Constructor. </summary>
 protected FilterServiceBase(FilterServiceGranularLockFactory lockFactory, bool allowIsolation)
 {
     _lockFactory            = lockFactory;
     _eventTypeIndex         = new EventTypeIndex(lockFactory);
     _indexBuilder           = new EventTypeIndexBuilder(_eventTypeIndex, allowIsolation);
     _filterServiceListeners = new CopyOnWriteArraySet <FilterServiceListener>();
 }
 /// <summary>
 /// Constructor - takes the event type index to manipulate as its parameter.
 /// </summary>
 /// <param name="lockManager">The lock manager.</param>
 /// <param name="eventTypeIndex">index to manipulate</param>
 /// <param name="allowIsolation">if set to <c>true</c> [allow isolation].</param>
 public EventTypeIndexBuilder(
     ILockManager lockManager,
     EventTypeIndex eventTypeIndex,
     bool allowIsolation)
 {
     _eventTypeIndex      = eventTypeIndex;
     _callbacksLock       = lockManager.CreateLock(GetType());
     _isolatableCallbacks = allowIsolation ? new Dictionary <FilterHandle, EventTypeIndexBuilderValueIndexesPair>() : null;
 }
Example #3
0
        public void SetUp()
        {
            SupportBean testBean = new SupportBean();

            _testEventBean = SupportEventBeanFactory.CreateObject(testBean);
            _testEventType = _testEventBean.EventType;

            _handleSetNode  = new FilterHandleSetNode(ReaderWriterLockManager.CreateDefaultLock());
            _filterCallback = new SupportFilterHandle();
            _handleSetNode.Add(_filterCallback);

            _testIndex = new EventTypeIndex(new FilterServiceGranularLockFactoryReentrant());
            _testIndex.Add(_testEventType, _handleSetNode);
        }
        public void SetUp()
        {
            _eventTypeIndex = new EventTypeIndex(_lockFactory);
            _indexBuilder   = new EventTypeIndexBuilder(_eventTypeIndex, true);

            _typeOne = SupportEventTypeFactory.CreateBeanType(typeof(SupportBean));
            _typeTwo = SupportEventTypeFactory.CreateBeanType(typeof(SupportBeanSimple));

            _valueSetOne = SupportFilterSpecBuilder.Build(_typeOne, new Object[0]).GetValueSet(null, null, null);
            _valueSetTwo = SupportFilterSpecBuilder.Build(_typeTwo, new Object[0]).GetValueSet(null, null, null);

            _callbackOne = new SupportFilterHandle();
            _callbackTwo = new SupportFilterHandle();
        }
Example #5
0
        public void TestInterfaceMatch()
        {
            _testEventBean = SupportEventBeanFactory.CreateObject(new ISupportABCImpl("a", "b", "ab", "c"));
            _testEventType = SupportEventTypeFactory.CreateBeanType(typeof(ISupportBaseAB));

            _testIndex = new EventTypeIndex(new FilterServiceGranularLockFactoryReentrant());
            _testIndex.Add(_testEventType, _handleSetNode);

            List <FilterHandle> matchesList = new List <FilterHandle>();

            _testIndex.MatchEvent(_testEventBean, matchesList);

            Assert.AreEqual(1, matchesList.Count);
            Assert.AreEqual(_filterCallback, matchesList[0]);
        }
Example #6
0
        public void TestSuperclassMatch()
        {
            _testEventBean = SupportEventBeanFactory.CreateObject(new ISupportAImplSuperGImplPlus());
            _testEventType = SupportEventTypeFactory.CreateBeanType(typeof(ISupportA));

            _testIndex = new EventTypeIndex(new FilterServiceGranularLockFactoryReentrant(_container.RWLockManager()));
            _testIndex.Add(_testEventType, _handleSetNode);

            List <FilterHandle> matchesList = new List <FilterHandle>();

            _testIndex.MatchEvent(_testEventBean, matchesList);

            Assert.AreEqual(1, matchesList.Count);
            Assert.AreEqual(_filterCallback, matchesList[0]);
        }
Example #7
0
        public void SetUp()
        {
            _container = SupportContainer.Reset();

            _lockFactory = new FilterServiceGranularLockFactoryReentrant(_container.RWLockManager());

            _eventTypeIndex = new EventTypeIndex(_lockFactory);
            _indexBuilder   = new EventTypeIndexBuilder(_container.LockManager(), _eventTypeIndex, true);

            _typeOne = SupportEventTypeFactory.CreateBeanType(typeof(SupportBean));
            _typeTwo = SupportEventTypeFactory.CreateBeanType(typeof(SupportBeanSimple));

            _valueSetOne = SupportFilterSpecBuilder.Build(_typeOne, new Object[0]).GetValueSet(null, null, null);
            _valueSetTwo = SupportFilterSpecBuilder.Build(_typeTwo, new Object[0]).GetValueSet(null, null, null);

            _callbackOne = new SupportFilterHandle();
            _callbackTwo = new SupportFilterHandle();
        }
Example #8
0
 /// <summary>
 /// Constructor - takes the event type index to manipulate as its parameter.
 /// </summary>
 /// <param name="eventTypeIndex">index to manipulate</param>
 public EventTypeIndexBuilder(EventTypeIndex eventTypeIndex, bool allowIsolation)
 {
     _eventTypeIndex      = eventTypeIndex;
     _callbacksLock       = LockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     _isolatableCallbacks = allowIsolation ? new Dictionary <FilterHandle, EventTypeIndexBuilderValueIndexesPair>() : null;
 }